Skip to content

Instantly share code, notes, and snippets.

@bvssvni bvssvni/syntax.txt
Created Jan 3, 2017

Embed
What would you like to do?
Syntax for a subset of English that is activity focused
_seps: "."
8 sentence = [activity:"activity" .w? "."]
9 expression = .s!([.w! {"&":"&" "|":"|"} .w!] activity:"term")
10 if = [{"if" "when"} .w! expression:"condition" .w! "then" .w! expression:"then"
.r?([.w! "else" .w! "if" .w! expression:"else_if_condition" .w!
"then" .w! expression:"else_if_then"])
?[.w! "else" .w! expression:"else"]]
11 activity = [!{"then" "else" "&" "|"} {
if:"if"
{
[{"do":"do" "does":"does"} objects how ?[.w! to] ?[.w! activity:"activity"]]
[
?[
![verbs .w!]
items:"subjects" .w!
]
?[{
"will":"will"
"would":"would"
"shall":"shall"
"should":"should"
"can":"can"
"could":"could"
"may":"may"
"might":"might"
"does":"do"
"do":"do"
"did":"did"
"start":"start"
"begin":"begin"
"end":"end"
"finish":"finish"
"continue":"continue"
} ?[.w! "not":"not"] .w!]
{
[verb ?[.w! "with" .w! activity:"with"] how
?[.w! to] .w! activity:"activity"]
[verb ?[.w! "with" .w! activity:"with"] how]
[!"then " !"&" items:"objects" how]
}
]
items:"objects"
}
}]
12 to = {"that" "to" "so" "because":"because"}
12 filter_items = {
"then"
"that"
"to"
"so"
"will"
"would"
"shall"
"should"
"can"
"could"
"may"
"might"
"do"
"did"
"is"
"are"
"was"
"where"
"now"
"yesterday"
"very"
"early"
"late"
keywords
}
12 items = [![filter_items .w!] {
[number .w! .._seps!:"item"]
[.._seps!:"item" .w! "and" .w! .s!([.w! "and" .w!] .._seps!:"item")]
.._seps!:"item"
} ?[.w! "or" .w! items:"or"] ?[.w! {
["but" .w! {"nothing" "none" "not" "no"}]
"except"
} .w! items:"except"]]
13 number = {
"a":"a"
"the":"the"
"some":"some"
"none":"none"
"few":"few"
"many":"many"
[?[0_999 .w!] "million":"million" ?[?[.w! "and"] .w! 0_999999]]
[?[0_999 .w!] "thousand":"thousand" ?[?[.w! "and"] .w! 0_999]]
[?[0_99 .w!] "hundred":"hundred" ?[?[.w! "and"] .w! 0_99]]
0_99
}
14 0_9 = {
"one":"one"
"two":"two"
"three":"three"
"four":"four"
"five":"five"
"six":"six"
"seven":"seven"
"eight":"eight"
"nine":"nine"
}
15 0_99 = {
"ten":"ten"
"eleven":"eleven"
"twelve":"twelve"
"thirteen":"thirteen"
"fourteen":"fourteen"
"fifteen":"fifteen"
"sixteen":"sixteen"
"seventeen":"seventeen"
"eighteen":"eighteen"
"nineteen":"nineteen"
["twenty":"twenty" .w! 0_9]
"twenty":"twenty"
["thirty":"thirty" .w! 0_9]
"thirty":"thirty"
["forty":"forty" .w! 0_9]
"forty":"forty"
["fifty":"fifty" .w! 0_9]
"fifty":"fifty"
["sixty":"sixty" .w! 0_9]
"sixty":"sixty"
["seventy":"seventy" .w! 0_9]
"seventy":"seventy"
["eighty":"eighty" .w! 0_9]
"eighty":"eighty"
["ninety":"ninety" .w! 0_9]
"ninety":"ninety"
0_9
}
16 0_999 = {
[?[0_9 .w!] "hundred":"hundred" ?[.w! "and" .w! 0_99]]
0_99
}
17 0_999999 = {
[?[0_999 .w!] "thousand":"thousand" ?[.w! "and" .w! 0_999]]
0_999
}
114 how = ?[.w! {
"how":"how"
"who":"who"
"when":"when"
"why":"why"
"what":"what"
"sometimes":"sometimes"
"always":"always"
"never":"never"
"now":"now"
"yesterday":"yesterday"
"tomorrow":"tomorrow"
[?["very":"very" .w!] "early":"early"]
[?["very":"very" .w!] "late":"late"]
[{
"last":"last"
"next":"next"
} .w! {
"week":"week"
"month":"month"
"year":"year"
"decade":"decade"
"century":"century"
"millenia":"millenia"
}]
}]
115 keywords = {
"to"
"with"
"how"
"when"
"why"
"what"
}
116 verbs = {
"think"
"learn"
"ask"
"plan"
"know"
"play"
"teach"
"swim"
"walk"
"win"
"read"
"observe"
"swim"
"walk"
"win"
"improve"
"run"
"compete"
"write"
"eat"
"love"
"sleep"
"trick"
"speak"
"tell"
"believe"
"has"
"want"
"wish"
"dance"
"forget"
"remember"
"communicate"
"store"
"invite"
"lie"
"fight"
"use"
"train"
"who"
"contain"
"fix"
"support"
"understand"
"go"
"figure"
"correspond"
"carry"
"follow"
"lead"
"wait"
}
117 objects = ?[.w! ![keywords .w!] items:"objects"]
118 verb = {
think_about:"think_about"
play:"play"
learn:"learn"
ask:"ask"
plan:"plan"
know:"know"
teach:"teach"
think:"think"
read_about:"read_about"
observe:"observe"
swim:"swim"
walk:"walk"
win:"win"
improve:"improve"
run:"run"
compete:"compete"
write_about:"write_about"
eat:"eat"
love:"love"
sleep_over:"sleep_over"
sleep:"sleep"
trick:"trick"
speak:"speak"
tell:"tell"
is:"is"
believe:"believe"
have:"have"
want:"want"
dance:"dance"
forget:"forget"
remember:"remember"
communicate:"communicate"
store:"store"
invite:"invite"
lie_about:"lie_about"
fight:"fight"
use:"use"
train:"train"
contain:"contain"
fix:"fix"
support:"support"
understand:"understand"
go:"go"
turn:"turn"
figure_out:"figure_out"
correspond:"correspond"
carry:"carry"
follow:"follow"
lead:"lead"
wait:"wait"
}
119 against = ?[.w! {
"against":"against"
"toward":"toward"
"beneath":"beneath"
"above":"above"
"between":"between"
} .w! items:"objects"]
121 description = {
"right":"right"
"wrong":"wrong"
"naughty":"naughty"
"sticky":"sticky"
"happy":"happy"
"sad":"sad"
"small":"small"
"tall":"tall"
"thin":"thin"
"fat":"fat"
"fresh":"fresh"
"newborn":"newborn"
"young":"young"
"old":"old"
"good":"good"
"evil":"evil"
"hungry":"hungry"
"thirsty":"thirsty"
"sleepy":"sleepy"
"solved":"solved"
"unsolved":"unsolved"
color
temperature
}
122 color = {
"black":"black"
"white":"white"
"blue":"blue"
"red":"red"
"orange":"orange"
"yellow":"yellow"
"gray":"gray"
"green":"green"
"violet":"violet"
"pink":"pink"
"brown":"brown"
"dark":"dark"
"bright":"bright"
"colorful":"colorful"
}
123 temperature = {
"warm":"warm"
"cold":"cold"
"stormy":"stormy"
"freezing":"freezing"
}
124 speed = ?[.w! {
"slow":"slow"
"fast":"fast"
}]
125 emotion_at = [{
"jealous":"jealous"
"angry":"angry"
"irritated":"irritated"
"annoyed":"annoyed"
} ?[.w! "at" objects]]
20 play = "play"
21 teach = ["teach" objects]
22 swim = ["swim" speed against]
23 walk = "walk"
24 win = ["win" against]
25 improve = "improve"
26 run = ["run" against]
27 compete = ["compete" against]
28 eat = ["eat" objects]
29 love = ["love" objects]
30 sleep = ["sleep"]
31 sleep_over = ["sleep" .w! "over" .w! "at" objects .w! .._seps!:"place"]
32 trick = ["trick" objects]
33 speak = ["speak" objects]
34 tell = ["tell" objects]
35 believe = "believe"
36 is = [?["who" .w!] {
"are":"now"
"is":"now"
"was":"past"
"were":"past"
"be":"future"
} ?[.w! "not":"not"] ?[?[.w! {
"little":"little"
"much":"much"
}] .w! {
"less":"less"
"more":"more"
}] .w! {description emotion_at}
?[.w! "than":"than" .w! {description emotion_at}]]
37 have = [{"have" "has"} ?[.w! description] objects]
38 want = [{"want" "wish"} ?[.w! "for"] ?[.w! description] objects]
39 dance = "dance"
40 forget = ["forget" ?[.w! description] objects]
41 remember = ["remember" ?[.w! description] objects]
42 communicate = "communicate"
43 store = ["store" objects]
44 invite = ["invite" objects]
45 fight = ["fight" against]
46 use = ["use" objects]
47 train = ["train" objects]
48 contain = ["contain" objects]
49 fix = ["fix" objects]
50 support = ["support" objects]
51 understand = ["understand" objects]
52 go = ["go" .w! {
"through":"through"
"under":"under"
"over":"over"
"around":"around"
} objects]
53 turn = "turn"
54 figure_out = ["figure" .w! "out"]
55 correspond = "correspond"
56 carry = ["carry" objects]
57 follow = ["follow" objects]
58 lead = ["lead" objects]
59 wait = ["wait" ?[.w! "for" objects]]
530 think_about = ["think" .w! "about" objects]
531 learn = ["learn" objects]
532 ask = ["ask" objects]
533 plan = "plan"
534 know = ["know" objects]
535 think = ["think" objects]
536 read_about = ["read" .w! "about" objects]
537 observe = "observe"
538 write_about = ["write" .w! "about" objects]
539 lie_about = ["lie" .w! "about" objects]
100 document = [.w? .l(sentence:"sentence") .w?]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.