[SOLVED] CS Left recursion

$25

File Name: CS_Left_recursion.zip
File Size: 160.14 KB

5/5 - (1 vote)

Left recursion
A grammar is left-recursive if there exists a nonterminal ! such that there is a derivation ! # ! $ for some string $
%%+(|( ((+|+ +% |,-
We cannot compute FIRST sets for left-recursive grammars.

Left recursion
A left-recursive grammar can be transformed to eliminate left recursion
!!+#|# ##(|( (! |*+
! #!$
!$ +# !$ | # (#$
#$ (#$| (! |*+

Eliminating immediate left recursion
!!&|# ! #! !% &!% | (

Eliminating immediate left recursion
!!+#|# ##(|( (! |*+
! #!$
!$ +# !$ | # (#$
#$ (#$| (! |*+

Eliminating immediate left recursion
In general

Indirect left recursion

Eliminating left recursion

Eliminating left recursion

Shopping Cart
[SOLVED] CS Left recursion[SOLVED] CS Left recursion
$25