{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

20100923

# 20100923 - = CS 441 Fall 2010 JWJ Pre-class notes do not...

This preview shows pages 1–2. Sign up to view the full content.

============================ CS 441 Fall 2010 -- JWJ Pre-class notes - do not distribute Thursday, September 23, 2010 ============================ Scope: FIRST and FOLLOW Sets (Part 2 -- FOLLOW sets) Outline: FIRST and FOLLOW sets -- solving symbolic equations Two grammars for arithmetical expressions ----------- left-recursive after removing left recursion E --> E + T | T E --> T E' E' --> + T E' | epsilon T --> T * F | F T --> F T' T' --> * F T' | epsilon F --> (E) | id | num F --> (E) | id | num FIRST sets: FIRST sets include terminals (tokens) or epsilon for nullable nonterminals. The tokens in the FIRST(X), where X is a nonterminal, are the only valid starting terminals for strings derived from X. For the above grammar for expressions, a valid expression may begin with '(', 'id" or 'num' and these three tokens are members of FIRST(E). For nullable nonterminals, epsilon is a member of their FIRST sets. FIRST sets can be computed based on the productions of the grammar, by first finding nullable nonterminals and then setting a system of equations. Alternatively, the second step could be replaced with a graph for FIRST sets and then computing its transitive closure.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

20100923 - = CS 441 Fall 2010 JWJ Pre-class notes do not...

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

View Full Document
Ask a homework question - tutors are online