Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 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 \\ - run the PDA on the given inputs \\ - is the grammar ambiguous? If yes, write a non ambiguous grammar that generates the same language \\ **10.1.1** input: aaaabb \\ $ S \leftarrow aS | aSb | \epsilon $ \\ **10.1.2** input: \\ $ S \leftarrow aAA \\ A \leftarrow aS | bS | a $ **10.1.3** input: \\ $ 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: * PAIRS: $ (10 | 01)* $ * ONES: $ 1+ $ * NO_CONSEC_ONE: $ (1 | \epsilon)(01 | 0)* $ Separate the following input strings into lexemes: * 010101 * 1010101011 * 01110101001 * 01010111111001010 * 1101101001111100001010011001