On 02/26/2012 03:25 AM, d coder wrote:
Greetings
I need to parse simple D expressions at compile time. I was wondering if
somebody on the list has some example code that could be of help to me.
I am working on an opensource constraint solver and expressions that I
need to parse can be reasonably complex such as "x + y*n < 32 && x > 4".
I want to code a string mixin that parses such expressions and writes
out code that creates a parse tree for the given expression.
Thanks and Regards
- Puneet
Operator precedence parsers are simple to implement:
http://effbot.org/zone/simple-top-down-parsing.htm