The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
1.8k views

Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order.

  1. Leftmost derivation
  2. Leftmost derivation traced out in reverse
  3. Rightmost derivation 
  4. Rightmost derivation traced out in reverse
asked in Compiler Design by Veteran (59.5k points) | 1.8k views
+4
but in case of bottom parser answer must be D
0
yes,

Bottom-up parser uses RIGHTMOST DERIVATION IN REVERSE

5 Answers

+13 votes
Best answer

ans A

answered by Loyal (5.2k points)
edited by
+8 votes
Top-down parser - Leftmost derivation

Bottom-Up parser - Reverse of rightmost derivation
answered by Loyal (7.3k points)
+1 vote
Ans: A Leftmost derivation
answered by Loyal (7.3k points)
0
what if input is assumed to be scaned from right to left?

then it RIGHT-most derivation, right?
0
Right most derivation means non terminals are replaced with terminal from right hand side first
0 votes
LMD uses top down parser
answered by (141 points)
0 votes

Leftmost derivation Top-down parsing (LL).

In top-down parsing, we just start with the start symbol and compare the right side of the different productions against the first piece of input to see which of the productions should be used.

A top-down parser is called LL parser because it parses the input from Left to right, and constructs a Leftmost derivation of the sentence. 

Option A is correct

answered by Loyal (9.3k points)
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,713 questions
46,750 answers
140,552 comments
58,385 users