This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Grammars Observations: We have seen in the case of the palindrome generator that SRSs are well suited for generating strings with structure. By modifying the standard SRS just slightly we obtain a convenient framework for generating strings with desirable structure Grammars Definition: [Grammar] A grammar is a triple ( , R , ) such that, = T N with T N = , where T is a set of symbols called the terminals and N is a set of symbols called the nonterminals , 1 R is a set of rules of the form u v with u , v , is called the start symbol and N . 1 The fact that T and N are nonoverlapping means that there will never be confusion between terminals and nonterminals. Grammars Example: Grammar for arithmetic expressions. We define the grammar ( , R , s ) as follows: = T N with T = { a , b , c , + , , ( , ) } and N = { E } , R is the set of rules, E E + E E E E E ( E ) E a E b E c = E (clearly this satisfies...
View
Full
Document
This note was uploaded on 10/03/2011 for the course CSC 501 taught by Professor Staff during the Spring '09 term at Rhode Island.
 Spring '09
 Staff

Click to edit the document details