Reputation: 1044
Hey! I am looking for an ANTLR grammar for parsing one variable function expressions. It should support +,-, /, ^, special functions (e.g. cos, sin) and constants (pi, e) and parenthesis. I tried writing it myself but I get left-recursion warnings. Does anyone have a example that I can get started with? I would like to write something like
x+sin(5x + pi^3)/(15e cos(x))
for example. ANTLR grammars are preferred but other (E)BNF examples will be appreciated.
Eventually I would like to use it with AST output.
THANX
Upvotes: 2
Views: 2000
Reputation: 1044
Ok, that was fast. I found a great article on code project.
It has everything I wanted and more!
Upvotes: 2