I am trying to create a very simple parser for an if-else statement with conditional expressions using java
The parse syntax :
stmnt ::= matched | unmatched
matched ::= if ( expr ) then matched else matched | others
unmatched ::= if ( expr ) then stmnt | if ( expr ) then matched else unmatched
exp ::= factor exp’
exp’ ::= factor | > factor | <> factor | == factor | >= factor | <= factor |
factor ::= id | num | ! id
I have been looking around the net at different types of parsing algorithms, all of them seeming very abstract and complex.
Are there any suggestions for good algorithm for this .