Referring to this link. It shows how to create a lisp style s-expression from any infix expression on Antlr3.
I am using Antlr4 and it doesn't seem to work on it.
Can someone please suggest me some way to achieve it ?
2x+3x^5
to (+ (* 2 x) (* 3 (^ x 5)))
Rewrite Rules are no longer available in ANTLR4 so you will have to do some other way. A possible approach is the the following:
Here there's an example of this process