This is an old revision of the document!
10. Context-Free Languages & Lexers
10.1. Context-Free Grammar to PDA conversion
For each context-free grammar G:
- describe L(G)
- algoritmically construct a PDA that accepts the same language
- is the grammar ambiguous? If yes, write a non ambiguous grammar that generates the same language
- $ S \leftarrow aS | aSb | \epsilon $
- $ S \leftarrow aAA \\ A → aS | bS | a $
- $ S \leftarrow ABC \\ A \leftarrow aA | \epsilon \\ B \leftarrow bbB | b \\ C \leftarrow cC | c$
10.2. Lexer Spec
Given the following specs, construct the lexer DFA as presented in lecture 14 [1]:
Separate the following input strings into lexemes: