The grammars use D as the start symbol, and use six terminal symbols int ; id [ ] num.
Grammar G1 | Grammar G2 |
---|---|
D → intL; | D → intL; |
L → id[E | L → idE |
E → num | E → E[num] |
E → num][E | E → [num] |
Which of the grammars correctly generate the declaration mentioned above?
Operator | Precedence | Associativity | Arity |
---|---|---|---|
+ | High | Left | Binary |
_ | Medium | Right | Binary |
* | Low | Left | Binary |
The value of the expression $$2 - 5 + 1 - 7 * 3$$ in this language is _______________.
$$\eqalign{ & \,\,\,\,\,\,\,S \to \,\,\,\,\,\,\,F|H \cr & \,\,\,\,\,\,F \to \,\,\,\,\,\,\,p|c \cr & \,\,\,\,\,\,H \to \,\,\,\,\,\,\,d|c \cr} $$
where $$S, F$$ and $$H$$ are non-terminal symbols, $$p, d,$$ and $$c$$ are terminal symbols. Which of the following statement(s) is/are correct?
$$\,\,\,\,\,\,\,S1.\,\,\,\,\,\,\,LL\left( 1 \right)\,\,$$ can parse all strings that are generated using grammar $$G$$
$$\,\,\,\,\,\,\,S2.\,\,\,\,\,\,\,LR\left( 1 \right)\,\,$$ can parse all strings that are generated using grammar $$G$$
A canonical set of items is given below
$$\eqalign{ & S \to L. > R \cr & Q \to R. \cr} $$On input symbol < the set has