retagged by
1,311 views
2 votes
2 votes
$\begin{align*} &\color{blue}{\text{Top down predictive parsers detect errors earlier than bottom up parsers (true/false)}} \\ &\color{maroon}{\text{Justify your answer}} \\ \end{align*}$
retagged by

1 Answer

–1 votes
–1 votes

Every Parser top down or bottom up needs a parsing table to parse any input according to given grammar.

Consider two statements:

1. given that if a language is top down parsable it is definitly bottom up parsable and are a strict subset of bottom up parsers.

2. Errors are based upon the number of blank entries in thr parsing table, which are more in bottom up parsers (say CLR (1)), therefore it is clear that error detection capability is more in bottom up parser.

Now the question is whether TDP is faster than BUP in error detection? The answer is No.

For a grammar which is Left recursive the parser would still try to parse it and would not report any errors until a non recoverable state (different from the input string) or a blank entry is encountered.

Eg.

It will parse a string 'abcd' and create a parse tree from top to down, but if an error occurs it will not report until it reaches the very leaf node at which the error is. 

While this is not the case in BUP as it will parse from every leaf node to the root node, therefore it will be able to make out which leaf is not derivable from the grammar given, before it makes a parent node.

And since there does not exist any class of language which is TDP parsable but not BUP parsable (as stated in (1)) and also there can never be more strict error detection in TDP as stated in (2).

We can conclude that no TDP can detect an error before BUP.

Kindly correct me if i am wrong.

Related questions

1 votes
1 votes
2 answers
1
gate_forum asked Dec 31, 2016
601 views
State True/False : "LR(0)⊂SLR(1)⊂LALR(1)⊂LR(1)".
0 votes
0 votes
1 answer
2
Sanket_ asked Nov 10, 2016
345 views
which is false?a) An unambiguous grammar has same RMD for every sentence.b)An ambiguous grammar may have an infinite no. of derivation trees for some sentences in the la...
2 votes
2 votes
2 answers
3
kallu singh asked Sep 5, 2017
637 views
Q if any Grammar is LL(1) definitely LALR(1) ?It is true or falsePlease ans explain in detail.
0 votes
0 votes
1 answer
4
Sagar Chintawar asked Feb 11, 2019
640 views
Construct the predictive parsing table for the grammar and tell whether the grammar is LL(1) or notS (L) / aL L, S / S