edited by
327 views
2 votes
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$
edited by

1 Answer

Answer:

Related questions

5 votes
5 votes
1 answer
1
Bikram asked May 14, 2017
555 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...
1 votes
1 votes
2 answers
4
Bikram asked May 14, 2017
298 views
“If one can do it, anyone can do it. If no one does it, I will do it.” The person who says the above statement seems to be: Sarcastic Optimistic Pragmatic Agnostic