Hi I have been taking some basic tutorials of parsing, I have been able to understand the basics of CFG and parse tree.
Take following grammar for basic equations:
term
: INTEGER
| '(' expression ')'
;
mult
: term ('*' term)*
;
add
: mult ('+' mult)*
;
expression
: add
;
What I would like to know is that how does it help us solve the equation? All of the tutorials end by making a parse tree or by writing a parser like a predictive parser, but all parser checkes is that if that expression is valid acc to grammar but it does not evaluate it.
Can anyone help me with that?