hw2 - CS 6353 Compiler Construction, Homework #2 1....

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

View Full Document Right Arrow Icon
CS 6353 Compiler Construction, Homework #2 1. Consider the following grammar. Note that the terminals include x, [, ], (, and ). S [ST] | T T (TF) | F F x | ε (a) Compute the First set for all nonterminals in the grammar. (b) Compute the First set for each production (i.e., the right side of the production). (c) Compute the Follow set for all non-terminals in the grammar. (d) Based on the First and Follow sets you obtained in (a), (b), and (c), determine whether the grammar is LL(1). Explain how your decision is made. (e) Build an LL(1) parsing table for the grammar. (f) Parse the string [[x()](((xx))x)]. When there are conflicts, choose the one you know that would work. Show the stack, the input, and the action taken. (g) Build the parse tree while you are parsing. Show your parse tree. 2. Consider the following grammar G. Note that T = {a, b, (, )}. S AB | ab A (a) | ε B (b) | ε (a) Show that G is not LL(1) (b) Build an LL(2) parse table for G. You can skip steps to quickly build the parse table. 3.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2012 for the course CS 6413 taught by Professor Ye during the Spring '07 term at University of Texas at Dallas, Richardson.

Page1 / 2

hw2 - CS 6353 Compiler Construction, Homework #2 1....

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

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