This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

cs-236:homework-4 [2015/09/30 10:49] egm |
cs-236:homework-4 [2015/09/30 10:49] (current) egm |
||
---|---|---|---|

Line 12: | Line 12: | ||

==Problems== | ==Problems== | ||

- | # (4 points) Do a brute force search to find a parse tree for the input ''int / int''. Use a top-down approach meaning you begin with the start rule (i.e., the first rule), and find a left-derivation. When choosing which rule to expand, go in order of the rules. The ''int'' terminal is an integer literal).\\ <E> ::= <T> - <E> | <T>\\ <T> ::= ( <E> ) | int | int / <T> | + | # (4 points) Do a brute force search to find a parse tree for the input ''int / int''. Use a top-down approach meaning you begin with the start rule (i.e., the first rule), and find a left-derivation. When choosing which rule to use in an expansion, go in order of the rules. The ''int'' terminal is an integer literal).\\ <E> ::= <T> - <E> | <T>\\ <T> ::= ( <E> ) | int | int / <T> |

# (2 points) Compute the FIRST sets for the following. Compute FOLLOW sets as well for extra credit.\\ <A> ::= <A><A>'+' | <A><A>'*' | a | # (2 points) Compute the FIRST sets for the following. Compute FOLLOW sets as well for extra credit.\\ <A> ::= <A><A>'+' | <A><A>'*' | a | ||

# (6 points) For each of the following grammars, build an LL(1) parse table. You may left-factor and/or eliminate left-recursion from your grammars first if needed: | # (6 points) For each of the following grammars, build an LL(1) parse table. You may left-factor and/or eliminate left-recursion from your grammars first if needed: |