# This grammar is derived from: # Jason Eisner and Noah A. Smith. Competitive Grammar # Writing. Proceedings of the Third Workshop on Issues in Teaching # Computational Linguistics, pp. 97-105. # This grammar uses a convention that # - terminals are lowercase (president) # - preterminals are capitalized (Noun) # - other nonterminals are all-caps (NP) # # This convention just makes grammars more readable to humans. Thus: # # - When *you* are writing grammars in questions 3 and 6, you should # follow this convention unless you have a good reason not to. # # - But your *program* should still work with grammars that don't # follow this convention. It should not pay any attention to # upper/lower case. From your program's point of view, # if there is at least one rule for rewriting a symbol, then # that symbol is a nonterminal and should be rewritten. ####################### # Rules for creating full sentences. 1 ROOT S . 1 ROOT S ! 1 ROOT is it true that S ? # mixing terminals and nonterminals is ok. # The basic grammar rules. Here's what the abbreviations stand for: # S = sentence # NP = noun phrase # VP = verb phrase # PP = prepositional phrase # Det = determiner (sometimes called "article") # Prep = preposition # Adj = adjective 1 S NP VP 1 VP Verb NP 1 NP Det Noun 1 NP NP PP 1 PP Prep NP 1 Noun Adj Noun # Vocabulary. Your program can see that "ate" is a terminal # symbol because there exists no rule for rewriting it. # Any symbol that can rewrite as a terminal (or a string of # terminals, like "chief of staff") is called a "preterminal." Notice # that a preterminal is a special kind of nonterminal. 1 Verb ate 1 Verb wanted 1 Verb kissed 1 Verb understood 1 Verb pickled 1 Det the 1 Det a 1 Det every 1 Noun president 1 Noun sandwich 1 Noun pickle 1 Noun chief of staff 1 Noun floor 1 Adj fine 1 Adj delicious 1 Adj perplexed 1 Adj pickled 1 Prep with 1 Prep on 1 Prep under 1 Prep in