• edited by
1,943 views
2 2 votes

here it is given bottom up parsing still action is given in middle so output should be GAAAAT??? Is it true that in syntax tree tanslation bottom up and top down gives same answer???

Let ' $G$ ' be a grammar with the following translations:
$\mathrm{S} \rightarrow$ p\{print "G"\} P
$\mathrm{P} \rightarrow$ q print " A " ) Q
$\mathrm{P} \rightarrow$ r\{print "T"\}
$P \rightarrow \varepsilon$ (print "E"\}
$\mathrm{Q} \rightarrow$ s\{print " A " ) P
$Q \rightarrow \varepsilon$ (print " O ")
What is the output produced for the input "pqsqsr" using the bottom-up parsing with above translations?

  1. TAAAG
  2. TAAAAG
  3. GAAA
  4. AAAGAT

1 Answer

Best answer
6 6 votes

bottom up evaluation.it will be TAAAAG..i have missed one A to write...
..

• selected by
Position:
Show:

Related questions

2 2 votes
0 0 answers
475
475 views
0 0 votes
1 1 answer
1.8k
1.8k views
Na462 asked Oct 8, 2018
1,783 views
I know that every S attributed grammar is L attributed but not vice versa. Can anybody give example of the case if i print the semantic rules using L attributed the resul...
0 0 votes
0 0 answers
1.2k
1.2k views
sidlewis asked Sep 2, 2018
1,176 views
Write semantic rules for the grammar below to compute the Boolean attribute A. evenx, which is true iff the sentence parsed has an even number of $x$ 's.\[\begin{array}{c...