390 views

2 Answers

0 votes
0 votes
It is not possible to determine whether the grammar S->aS is left recursive based on the given grammar. In order to determine whether grammar is left recursive, we need to know the complete set of rules that define the grammar.

A left recursive grammar is a grammar in which one or more non-terminal symbols can be replaced by themselves through a series of rules that start with the non-terminal symbol itself. For example, the grammar S -> S + S is left recursive because the non-terminal symbol S can be replaced by itself through a series of rules that start with S.

To determine whether a grammar is left recursive, we need to examine all of the rules in the grammar and check for left recursion. If any of the rules are left recursive, then the grammar is left recursive. If none of the rules are left recursive, then the grammar is not left recursive.

It is important to note that left recursive grammars can be problematic because they can lead to infinite loops during parsing. In order to parse a left recursive grammar, it is often necessary to transform the grammar into an equivalent form that is not left recursive. This can be done using a process called left factoring
edited by
0 votes
0 votes
Since in the above production the variable are in right side of terminal it is right recursion so no need to eliminate

Related questions

1 votes
1 votes
1 answer
1