lib/zenlish/parser/zenlish_grammar.rb in zenlish-0.1.09 vs lib/zenlish/parser/zenlish_grammar.rb in zenlish-0.1.10
- old
+ new
@@ -9,25 +9,31 @@
builder = Rley::Syntax::GrammarBuilder.new do
add_terminals(*$ZenlishLexicon.terminals)
rule 'language' => 'sentence'
rule 'sentence' => 'simple_sentence Period'
+ rule 'sentence' => 'complex_sentence Period'
rule 'simple_sentence' => 'declarative_simple_sentence'
- rule 'simple_sentence' => 'conditional_statement'
+ rule 'complex_sentence' => 'main_clause subordination_marker dependent_clause'
+ rule 'complex_sentence' => 'subordination_marker dependent_clause Comma main_clause'
+ rule 'complex_sentence' => 'subordination_marker dependent_clause Comma LinkingAdverb main_clause'
+ rule 'subordination_marker' => 'SubordinatingConjunction'
+ rule 'subordination_marker' => 'SubordinatingConjunction PrepositionOf'
rule 'declarative_simple_sentence' => 'affirmative_sentence'
rule 'declarative_simple_sentence' => 'negative_sentence'
+ rule 'main_clause' => 'simple_sentence'
+ rule 'dependent_clause' => 'simple_sentence'
+ rule 'dependent_clause' => 'DemonstrativePronoun'
rule 'affirmative_sentence' => 'noun_phrase verb_phrase'
rule 'affirmative_sentence' => 'AdverbThere IrregularVerbBe verb_be_complement'
rule 'affirmative_sentence' => 'numeral_of IrregularVerbBe verb_be_complement'
rule 'affirmative_sentence' => 'DemonstrativePronoun IrregularVerbBe verb_be_complement'
rule 'affirmative_sentence' => 'conjunctive_prefix IrregularVerbBe verb_be_complement'
rule 'negative_sentence' => 'noun_phrase negative_verb_phrase'
rule 'negative_sentence' => 'AdverbThere negative_verb_phrase'
rule 'negative_sentence' => 'numeral_of negative_verb_phrase'
rule 'negative_sentence' => 'conjunctive_prefix negative_verb_phrase'
- rule 'conditional_statement' => 'condition_subordinate Comma LinkingAdverb declarative_simple_sentence'
- rule 'condition_subordinate' => 'SubordinatingConjunction declarative_simple_sentence'
rule 'conjunctive_prefix' => 'ConjunctivePronoun noun_phrase verb_phrase'
rule 'noun_phrase' => 'simple_noun_phrase'
rule 'noun_phrase' => 'compound_noun_phrase'
rule 'simple_noun_phrase' => 'nominal'
rule 'simple_noun_phrase' => 'determiner nominal'
@@ -57,10 +63,12 @@
rule 'single_determiner' => 'DemonstrativeDeterminer'
rule 'single_determiner' => 'DefiniteArticle'
rule 'single_determiner' => 'IndefiniteQuantifier'
rule 'verb_phrase' => 'verb_group'
rule 'verb_phrase' => 'verb_group verb_complement'
+ rule 'verb_phrase' => 'RegularVerb propositional_phrase'
+ rule 'verb_phrase' => 'IrregularVerbDo DemonstrativePronoun'
rule 'verb_phrase' => 'IrregularVerbBe verb_be_complement'
rule 'verb_phrase' => 'IrregularVerbSay Colon Quote affirmative_sentence Period Quote'
rule 'verb_complement' => 'noun_phrase'
rule 'verb_complement' => 'adverb_phrase'
rule 'verb_complement' => 'noun_phrase adverb_phrase'
@@ -75,10 +83,11 @@
rule 'verb_group' => 'lexical_verb'
rule 'verb_group' => 'AuxiliaryBe lexical_verb'
rule 'lexical_verb' => 'RegularVerb'
rule 'lexical_verb' => 'IrregularVerb'
rule 'lexical_verb' => 'IrregularVerbBe'
+ rule 'lexical_verb' => 'IrregularVerbDo'
rule 'lexical_verb' => 'IrregularVerbHave'
rule 'lexical_verb' => 'IrregularVerbSay'
rule 'numeral' => 'Cardinal'
rule 'comparative_clause' => 'comparative_start noun_phrase'
rule 'comparative_clause' => 'comparative_start affirmative_sentence'
@@ -89,10 +98,10 @@
rule 'adverb_phrase' => 'Adverb propositional_phrase'
rule 'propositional_phrase' => 'preposition propositional_complement'
rule 'propositional_phrase' => 'preposition'
rule 'propositional_complement' => 'noun_phrase'
rule 'preposition' => 'Preposition'
- rule 'preposition' => 'PrepositionOf'
+ rule 'preposition' => 'PrepositionOf'
end
# CGE p. 354 The order of determiners: quantifier > article or demonstrative
# or possessive > numeral > head