ANTLR, Dynamic variables
Posted
by JTS
on Stack Overflow
See other posts from Stack Overflow
or by JTS
Published on 2010-06-11T16:28:11Z
Indexed on
2010/06/11
16:32 UTC
Read the original article
Hit count: 287
antlr
Hello,
I have an ANTLR grammar that can parse and evaluate simple expressions like 1+2*4, etc. What I would like to do is to evaluate expressions like 2+$a-$b/4 where the $ variables are dynamic variables, that come from an external source and are continuously updated.
Is there any design pattern on how to do this using ANTLR, best practices, etc?
- Shall I "substring" the $a with the updated value ($a -> 4.34)
- A nicer way to do this?
Thx
© Stack Overflow or respective owner