What do you mean by a Handle? Give example. When a grammar is called ambiguous? Is there any technique to remove ambiguity? Explain with an example. What is the reduce-reduce conflict in LR parser? What are various data structures used for symbol table construction?
A left-recursion production of the form A → Aα | β could be replaced by the non-left-recursive productions as follows:
Without changing the set of strings derivable from A.
The basic idea is that when it is not clear which of two alternative productions to use to expand a non-terminal A, then rewrite the A-productions to defer the decision until the input to make the right choice.
In general, a production is of the form A → αβ1 | αβ2 then it is left factored as:
One problem may generate in case of producing Canonical collections for LR (0) parsing table. Assume that there is a state like as follows:
I5
A→α.
B→β
So the transition table will be:
|
Action |
|
|
a |
b |
I5 |
r1/r2 |
r1/r2 |
|
… |
… |
We can notice that there are 2 final states, so two reduce functions in each action. It is called reduce-reduce conflict. In SLR (1), it will conflict only when FOLLOW(α)∩FOLLOW(β)≠Ø.
Among all, symbol tables are mostly implemented as hash tables, where the source code symbol itself is treated as a key for the hash function and the return value is the information about the symbol.
For the input expression (4*7+1)*2, construct an annotated parse tree.
Define Quality Planning
Write a C program to print the fibonacci series.
Explain View with suitable example. What is the usefulness of a view?
Why Required of ISO 9001:2000 standard?