A small LL1 analyser that can remove recusrsion, calculate the first and follow of a given production rules then you can enter a word to analyse it.
- terminal must be lower case
- non-terminals must be upper case
- terminals and non-terminals should be one character at most
- epsilon are represented by the character '&'
gcc LL_1_parser.c -o LL1
./LL1
after running you can type the following production rules as an exemple :
E->E+T|T
T->T*F|F
F->(E)|d
.
when u finish typing your prodution rules you need to type '.' then press enter
- this is the result of the first step of the execution
now we jump to next step wich is verifying a given word matching our production rules (grammar) or not. so we type this word for exemple: (d+d)*(d+d)
note: non-terminal characters must be the same as the non-terminals entred in the production rules.
for exemple the word (5+5)*5 will not be accepted despite it is correct instead you should type (d+d)*d
as we can see it tell's us that this word is accepted !.
sorry for the one file code 😕