Consider the grammar with nonterminals N = {S, C, S1} terminals T = {a, b, i, t, e} With S as the start symbol , and the following set of rules :

S → i Ct SS1|a

S1 → es | ∈

C → b

The grammar is not LL(1) because : 

This question was previously asked in
NIELIT Scientific Assistant CS 5 Dec 2021 Official Paper
View all NIELIT Scientific Assistant Papers >
  1. It is left recursive
  2. It is right recursive 
  3. It is ambiguous
  4. It is not context free

Answer (Detailed Solution Below)

Option 1 : It is left recursive
Free
NIELIT Scientific Assistant Quantitative Aptitude Mock Test
0.5 K Users
20 Questions 20 Marks 30 Mins

Detailed Solution

Download Solution PDF

The correct answer is It is left recursive.

Key Points

  • The grammar is not LL(1) because it is left recursive.
  • Left recursion in a grammar occurs when a non-terminal appears as the first symbol on the right-hand side of its own production.
  • In this grammar, the production rule S → i Ct SS1 indicates that the non-terminal S is left recursive.
  • Due to this left recursion, it is not possible to construct a predictive parser (such as an LL(1) parser) since it relies on the first symbol of the production.
  • An LL(1) parser requires that the first symbol of each production is unique to make a decision, which is not possible in the presence of left recursion.

Additional Information

  • To convert this grammar to an LL(1) grammar, left recursion must be eliminated.
  • This can be achieved by transforming the grammar into an equivalent one without left recursion.
  • For example, the production S → i Ct SS1 | a can be transformed by introducing new non-terminals and adjusting the rules accordingly.
  • Eliminating left recursion ensures that the parser can make decisions based on the first symbol of the production, making it suitable for LL(1) parsing.
Latest NIELIT Scientific Assistant Updates

Last updated on Feb 20, 2025

-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.

-> Online application form, last date has been extended up to from 17th April 2025.

->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.

 

-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).

More Context Free Languages and Pushdown Automata Questions

Get Free Access Now
Hot Links: teen patti online game teen patti gold apk download teen patti noble