Question
QUESTION 1 What are three reasons why lexical analysis is separated from syntax analysis? (one word each) QUESTION 2 Breifly describe three advantages of LR
QUESTION 1
What are three reasons why lexical analysis is separated from syntax analysis? (one word each)
QUESTION 2
Breifly describe three advantages of LR parsers.
QUESTION 3
Why are named constants used, rather than numbers, for token codes?
QUESTION 4
What are the two distinct goals of syntax analysis?
QUESTION 5
Perform the pairwise disjointness test for each of the following grammar rules.
Your answer should show the FIRST() function for each RHS, and then state whether the LHS rule passes or failspairwise disjointness by examining all pairs of RHS FIRST()'s.
To get you started, the first RHS is:
FIRST(aB) = {a}
a. A aB | b | cBB
b. B aB | bA | aBb
c. C aaA | b | caB
Perform the pairwise disjointness test for each of the following grammar rules.
Your answer should show the FIRST() function for each RHS, and then state whether the LHS rule passes or fails pairwise disjointness.
a. S aSb | bAA
b. A b{aB} | a
c. B aB | a
QUESTION 7
Using the algorithm described in Section 4.4.2, remove direct left recursion form the following grammar rules.
A Aa | Abc | bc | d
QUESTION 8
Using the algorithm described in Section 4.4.2, remove direct left recursion form the following grammar rules.
X Xyy | Xz | Yx | w Y Yy | Yw | zy | x
QUESTION 10
Show a complete parse, including the parse stack contents, input string, and action for the string (id + id) * id, using the grammar and parse table in Section 4.5.3.
Use the "insert table" button to create a three column table (like the one on p.197 of the textbook).
You may use either the textbook notation, i.e. without parentheses or Dr. Davis' notation, i.e. with paired (state, token) on the stack.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started