csc501-ln003

csc501-ln003 - Grammars Observations: We have seen in the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 non-terminals , 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 non-overlapping means that there will never be confusion between terminals and non-terminals. 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.

Page1 / 10

csc501-ln003 - Grammars Observations: We have seen in the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online