arrow
arrow
arrow
Given below are two statements: Statement I: LL (1) and LR are examples of Bottom-up parsers. Statement II: Recursive descent parser and
Question



Given below are two statements:
Statement I: LL (1) and LR are examples of Bottom-up parsers.
Statement II: Recursive descent parser and SLR are examples of Top-down parsers.
In light of the above statements, choose the correct answer from the options given below:

A.

Both Statement I and Statement II are true.

B.

Both Statement I and Statement II are false.

C.

Statement I is true but Statement II is false.

D.

Statement I is false but Statement II is true.

Correct option is B


Statement I:
· LL (1) parsers are examples of top-down parsers, not bottom-up parsers. They parse the input from left-to-right and produce a leftmost derivation.
· LR parsers (such as SLR, CLR, LALR) are bottom-up parsers. They work by reducing the input string to the start symbol of the grammar.
Hence, Statement I is false.
Statement II:
· Recursive descent parsers are top-down parsers, which build the parse tree starting from the root and work towards the leaves. This part of the statement is true.
· However, SLR parsers are bottom-up parsers, not top-down parsers. They reduce substrings (right-hand sides of production rules) to non-terminals (left-hand sides).
Hence, Statement II is also false.
Information Booster
1. Top-Down Parsing:
· Starts from the root of the parse tree and tries to construct it down to the leaves.
· Examples: Recursive Descent Parsing, LL (1) Parsing.
· Predictive parsers belong to this category and require the grammar to be LL(k).
2. Bottom-Up Parsing:
· Starts from the leaves (input symbols) and attempts to construct the parse tree up to the root.
· Examples: LR (0), SLR (1), LALR (1), CLR (1).
3. Key Differences Between LL and LR Parsers:
· LL Parsers: Use left-to-right scanning and leftmost derivation.
· LR Parsers: Use left-to-right scanning and rightmost derivation (in reverse).
4. Recursive Descent Parsing:
· A manual implementation technique for top-down parsers.
· Can handle grammars that are not left-recursive or ambiguous.

Additional Knowledge
· Recursive descent parsing is simple but inefficient for handling complex grammars.
· Bottom-up parsers are more powerful and can handle a broader range of grammars compared to top-down parsers.
· SLR parsers are simpler but less powerful than CLR or LALR parsers.

Free Tests

Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English
Free
Must Attempt

UGC NET Paper 1 Mock Test 1

languageIcon English
  • pdpQsnIcon50 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt

Basics of Education: Pedagogy, Andragogy, and Hutagogy

languageIcon English
  • pdpQsnIcon10 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon12 Mins
languageIcon English

Similar Questions

test-prime-package

Access ‘UGC NET Computer Science’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow