- Joined
- Jul 10, 2007
- Messages
- 6,306
So, currently I'm working on exercise 2 in the Antlr4 book, and I have built a 5 operation calculator that works with doubles.
It's able to parse things like this and give the results
a = 2 3(3+3)(3)a
b = 4(2^3*2)
a/b
Now, what I currently can't do is stuff like this
//where a has no value
3a + 4a //should output 7a, but will output 0 as a is assumed to be 0
Any suggestions? Right now I'm just using a Visitor. Will I need to change over to a Listener?
Should the Visitor instead return expressions?
Thanks =)
It's able to parse things like this and give the results
a = 2 3(3+3)(3)a
b = 4(2^3*2)
a/b
Now, what I currently can't do is stuff like this
//where a has no value
3a + 4a //should output 7a, but will output 0 as a is assumed to be 0
Any suggestions? Right now I'm just using a Visitor. Will I need to change over to a Listener?
Should the Visitor instead return expressions?
Thanks =)