• edited by
793 views
2 2 votes

Read the following grammars and their translations:

  • $S\rightarrow xX\;\left \{ print ``0" \right \}$
  • $X\rightarrow zZ\;\left \{ print ``1" \right \}$
  • $X\rightarrow y\;\left \{ print ``2" \right \}$
  • $X\rightarrow e\;\left \{ print ``-" \right \}$
  • $Z\rightarrow pX\;\left \{ print ``1" \right \}$
  • $Z\rightarrow e\;\left \{ print ``0" \right \}$


What is the output produced for the input string $xzpzpy$ using Bottom-Up Parsing (with the above translations)?

  1. $0111012$
  2. $0111-20$
  3. $0211-10$
  4. $011112$

1 Answer

Answer:
Position:
Show:

Related questions

5 5 votes
1 answers 1 answer
1.3k
1.3k views
Bikram asked May 14, 2017
1,278 views
Consider the $C$ program given below:#include <stdio.h main () { printf("This is GO mock exam\n" ); }The total number of tokens generated when this program is passed to l...
4 4 votes
1 answers 1 answer
867
867 views
Bikram asked May 14, 2017
867 views
Consider the following statements :$S1$: Automatic garbage collection is not essential to implement recursion.$S2$: Operator precedence parser falls under the category ...
1 1 vote
1 answers 1 answer
1.5k
1.5k views
Bikram asked Jan 16, 2017
1,467 views
A shift reduced parser carries out the actions specified within braces Immediately after reducing with the corresponding rule of grammar.S xxW (print 'a') S Y (print'...
3 3 votes
1 answers 1 answer
1.7k
1.7k views
Bikram asked Nov 25, 2016
1,685 views
Consider the following syntax directed definition of any desk calculator:$L \rightarrow En \{ \text{print}(E.val) \}$$E \rightarrow E1 + 1 \{ E.val = E1.val + Z.val \}$$E...