Analyzing LL (1) grammar, recursive descent parser

1. grammar G (S):

(1)S -> AB

(2)A ->Da|ε

(3)B -> cC

(4)C -> aADC |ε

(5)D -> b|ε

Verify grammar G (S) is not LL (1) grammar?

 

 

 

2. (last job) after the elimination of left recursion whether the expression grammar is LL (1) grammar?

 

 

 

3. The connection 2, if it is LL (1) grammar, write its recursive descent parser code.

E()

    {T();

       E'();

     }

E'()

T()

T'()

F()

 

 

 

Experiment 4. Add a lexical analyzer, parser can form a run, analyzing any input symbol string is not a valid expression.

 

 

Guess you like

Origin www.cnblogs.com/hoioh/p/11895850.html