dcoder:
> 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.

OK, doing a bit of thread necromancy here (3 weeks, still acceptable here?)

Puneet, I might have something for you. IIUC, you want to parse expressions that are

- an association of boolean expressions (&&, ||, !)
- each boolean expression is an equation (=, <=, >, etc)
- each equation lhs or rhs is an arithmetic expression (+, -, *, /)
- atoms in an arithmetic expression can be numbers or variables

Is that it? You do realize that any parse tree will for these constructs will be quite deep, right? I mean, 10-levels deep or somesuch.

Philippe