Anda di halaman 1dari 2

The Lemon Parser Algorithm

1. lexical analysis:
it scans the source code of CFG and load the grammer to the symbol table. If ther is
any error in CFG it just report & halts down.

2. FindRulePrecedences:
Find precedence of symbols & set it

3. FirstSet:
compute FIRST(X):
a. If X is a terminal, then FIRST(X) = {X}
b. X is a nonterminal, travel all production of X until find first terminal .
4. Construct Parse Stack
5. Convert backward propagation link to forward link
6. FollowSet
7. ComputeAction table
8. Compress action table
9. ReportState
10.ReportFileoutput
11. GenerateCFGEngine2C Language

Debugging Your Parser:


To debug the CFG created by you, you need to have little knowledge on how lemon
parser algorithm works. For this purpose you can generate the report so that you can see
the step by step of each and every state
how you grammar has parsed.
Ex:
1. Compatible with turbo c compiler in dos:
2 Generate VCG Graph :
3. Generate for C++ Code:
4 Lemon also needs to support to build c++ code as output.
5. state_insert => has two parameter , we can remove second parameter because
first paremeter state holds it;

Anda mungkin juga menyukai