Compiler 1 and 2
Compiler 1 and 2
Compiler 1 and 2
1. A lexical analyzer uses the following patterns to recognize three tokens T1, T2, and
T3 over the alphabet {a,b,c}. T1: a?(b∣c)*a T2: b?(a∣c)*b T3: c?(b∣a)*c
If the string bbaacabc is processes by the analyzer, which sequence of tokens it
outputs?
Which of the following lexical entries can be derived from < word > ?
I. pick
II. picks
III. c44
E→ E*F|F+E|F
7.
F → F - F | id
S→F⎪H
F→p⎪c
H→d⎪c
Compute First(S).
Compute Follow(B).
S → aSC | b
C → cC | d
How many steps are needed to derive the string aabcdd using leftmost derivation?
18. For the grammar below, a partial LL(1) parsing table is also presented along with the
grammar. Entries that need to be filled are indicated as E1, E2, and E3. is the empty
string, $ indicates end of input, and, | separates alternate right hand sides of
productions.
S → iCtSS1|a
S1 → eS|ϵ
C→ b
In the predictive parser table, M, of the grammar, what are the entries M[S, id] and
M[R, $] ?