Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
166 lines (126 sloc) 3.91 KB
#
# This is a grammar for player action command parsing.
#
whitespace = /[ \b\t\n]/
_word = /[a-z][-a-z]*/
string = /"[^"]*"/
number = /[1-9][0-9]*/
sentence : commands
sentence : commands ',' string ? _evocation
sentence : commands string ? _evocation
sentence : communication ',' string ? _evocation
sentence : communication string ? _evocation
sentence : communication topic ? _add_topic
commands : command
commands : commands 'then' command ? _commands
command : ttv ? _command
command : btv ? _command
command : tv ? _command
command : verb_only ? _command
communication : comm ? _command
comm_verb_only : adverbs comm_verb adverbs
comm_language : 'in' word ? _indirect_noun_phrase
comm_target : indirect_noun_phrase
comm : comm_verb_only
comm : comm_verb_only comm_language
comm : comm_verb_only comm_target
comm : comm_verb_only comm_language comm_target
comm : comm_verb_only comm_target comm_language
comm : comm_language comm_verb_only
comm : comm_language comm_verb_only comm_target
comm : comm_language comm_target comm_verb_only
comm : comm_target comm_verb_only
comm : comm_target comm_verb_only comm_language
comm : comm_target comm_language comm_verb_only
topic : 'about' words ? _topic
topic : 'that' words ? _topic
verb_only : adverbs verb adverbs
tv : verb_only dnp adverbs
tv : adverbs dnp verb_only
btv : verb_only indirect_noun_phrase adverbs dnp adverbs
btv : tv indirect_noun_phrase adverbs
btv : adverbs dnp adverbs indirect_noun_phrase verb_only
btv : adverbs indirect_noun_phrase tv
ttv : btv instrument_noun_phrase adverbs
ttv : adverbs instrument_noun_phrase btv
ttv : verb_only indirect_noun_phrase instrument_noun_phrase dnp adverbs
ttv : tv instrument_noun_phrase indirect_noun_phrase adverbs
ttv : adverbs dnp instrument_noun_phrase indirect_noun_phrase verb_only
ttv : adverbs indirect_noun_phrase instrument_noun_phrase adverbs tv
adverbs :
adverbs : adverb
adverbs : adverbs adverb
adverbs : adverbs 'and' adverb ? _remove_and
word : _word
word : verb
word : comm_verb
word : 'front'
#word : adverb
words : word
words : words word
instrument_preposition : 'with'
instrument_preposition : 'using'
instrument_preposition : 'in'
rel_preposition : 'in'
rel_preposition : 'on'
rel_preposition : 'against'
rel_preposition : 'close'
rel_preposition : 'close' 'to' ? _rel_prep
rel_preposition : 'under'
rel_preposition : 'near'
rel_preposition : 'over'
rel_preposition : 'behind'
rel_preposition : 'before'
rel_preposition : 'in' 'front' 'of' ? _rel_prep
rel_preposition : 'beside'
rel_preposition : 'containing'
rel_preposition : 'holding'
rel_preposition : 'with'
rel_preposition : 'guarding'
rel_preposition : 'blocking'
indirect_preposition : 'from'
indirect_preposition : 'to'
indirect_preposition : 'at'
indirect_preposition : 'through'
indirect_preposition : 'from' rel_preposition
indirect_preposition : 'to' rel_preposition
dnp : objects ? _direct_noun_phrase
indirect_noun_phrase : indirect_preposition objects ? _indirect_noun_phrase
instrument_noun_phrase : instrument_preposition objects ? _instrument_noun_phrase
noun_phrase : opt_quantifier adjectives word
objects : noun ? _init_object_set
objects : objects conjunction noun ? _object_set
noun : 'all' ? _noun_phrase
noun : noun_phrase ? _noun_phrase
noun : noun rel_preposition noun_phrase ? _noun_path
conjunction : 'and' ? _noop
adjectives :
adjectives : word
adjectives : adjectives word
article : 'the'
article : 'a'
article : 'an'
article : 'any'
article : 'my'
article : 'her'
article : 'his'
article : 'its'
article : 'their'
quantifier : article
quantifier : article number
quantifier : number
quantifier : 'all'
quantifier : fraction
quantifiers : quantifier
quantifiers : quantifiers 'of' quantifier
opt_quantifier :
opt_quantifier : quantifiers
fraction : number '/' number
comm_verb : cv ? _verb
cv : 'say'
verb : v ? _verb
adverb : adv ? _adverb
#
# The verbs and adverbs are added to the grammar as they are added in the
# IFLib verb/adverb systems.
#