Is there a way, whilst parsing source of a statically-scoped nested language such as Pascal (which allows nested subroutines), of maintaining binding information (list of name-value pairs as they are encountered in the source) ? The difficulty is…
I am attempting to parse a boolean expression using the Happy library. The problem is that the result is not as good as I would want it when I introduce parentheses. I have made the following grammar.
Query : Expr { $1 }
Expr …
to calculate the value of the expression on the fly at the production rules in happy doesn't work if I'm using the lambda expressions.
For example this code
Exp : let var '=' Exp in Exp { \p -> $6 (($2,$4 p):p) }
| Exp1 …