tags:

views:

29

answers:

0

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