lib/zenlish/parser/zenlish_grammar.rb in zenlish-0.1.0 vs lib/zenlish/parser/zenlish_grammar.rb in zenlish-0.1.01
- old
+ new
@@ -10,20 +10,31 @@
add_terminals(*$ZenlishLexicon.terminals)
# add_terminals('Period')
rule 'language' => 'sentence'
rule 'sentence' => 'simple_sentence'
- rule 'simple_sentence' => 'declarative_simple_sentence'
- rule 'declarative_simple_sentence' => 'noun_phrase verb_phrase Period'
- rule 'noun_phrase' => 'noun'
- rule 'noun' => 'ProperNoun'
- rule 'noun' => 'CommonNoun'
- rule 'verb_phrase' => 'lexical_verb complement'
+ rule 'simple_sentence' => 'declarative_simple_sentence Period'
+ rule 'declarative_simple_sentence' => 'noun_phrase verb_phrase'
+ rule 'noun_phrase' => 'noun_bar'
+ rule 'noun_phrase' => 'determiner noun_bar'
+ rule 'noun_phrase' => 'numeral noun_bar'
+ rule 'noun_phrase' => 'determiner numeral noun_bar'
+ rule 'noun_phrase' => 'ProperNoun'
+ rule 'noun_phrase' => 'IndefinitePronoun'
+ rule 'noun_bar' => 'CommonNoun'
+ rule 'noun_bar' => 'Adjective CommonNoun'
+ rule 'noun_bar' => 'Adjective CommonNoun comparative_clause'
+ rule 'determiner' => 'DemonstrativeDeterminer'
+ rule 'determiner' => 'DefiniteArticle'
+ rule 'verb_phrase' => 'lexical_verb'
+ rule 'verb_phrase' => 'lexical_verb noun_phrase'
rule 'lexical_verb' => 'IrregularVerb'
- rule 'complement' => 'ProperNoun'
- rule 'complement' => 'IndefinitePronoun'
- rule 'complement' => 'DemonstrativeDeterminer noun'
- rule 'complement' => 'DefiniteArticle Adjective CommonNoun'
+ rule 'numeral' => 'Cardinal'
+ rule 'comparative_clause' => 'comparative_start noun_phrase verb_phrase'
+ rule 'comparative_start' => 'ComparativeParticle'
end
+
+# CGE p. 354 The order of determiners: quantifier > article or demonstrative
+# or possessive > numeral > head
# And now build the grammar...
ZenlishGrammar = builder.grammar