835 views
2 2 votes

In Fig. $4.56$ is a grammar for certain statements, similar to that discussed in Question $4.4.12$. Again, $e$ and $s$ are terminals standing for conditional expressions and "other statements," respectively.

  1. Build an LR parsing table for this grammar, resolving conflicts in the usual way for the dangling-else problem.
  2. Implement error correction by filling in the blank entries in the parsing table with extra reduce-actions or suitable error-recovery routines.
  3. Show the behavior of your parser on the following inputs:

 

  1. if e then s ; if e then s end
  2. while e do begin s ; if e then s ; end

 

Please log in or register to answer this question.

Position:
Show:

Related questions

0 0 votes
0 0 answers
1.3k
1.3k views
admin asked Aug 20, 2019
1,332 views
Consider the family of grammars $G_{n}$, defined by:$S\rightarrow A_{i}b_{i}$ for $1\leq i\leq n$$A_{i} \rightarrow a_{j} A_{i}\mid a_{j}$ for $1\leq i,j\leq n$ and $i\ne...
0 0 votes
0 0 answers
1.1k
1.1k views
admin asked Aug 20, 2019
1,135 views
The following is an ambiguous grammar for expressions with $n$ binary, infix operators, at $n$ different levels of precedence: $E\rightarrow E\theta_{1}E\mid E\theta_{2}E...
0 0 votes
0 0 answers
462
462 views
admin asked Aug 20, 2019
462 views
We suggested that individual items could be regarded as states of a nondeterministic finite automaton, while sets of valid items are the states of a deterministic finite ...
0 0 votes
0 0 answers
579
579 views
admin asked Aug 20, 2019
579 views
Construct thecanonical LR, andLALR sets of items for the grammar $S\rightarrow S S + \mid S S \ast \mid a$ of Question $4.2.1$.