<p><br>
dcoder:<br>
> 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.<br>
><br>
> 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.</p>

<p>OK, doing a bit of thread necromancy here (3 weeks, still acceptable here?)</p>
<p>Puneet, I might have something for you. IIUC, you want to parse expressions that are</p>
<p>- an association of boolean expressions (&&, ||, !)<br>
- each boolean expression is an equation (=, <=, >, etc)<br>
- each equation lhs or rhs is an arithmetic expression (+, -, *, /)<br>
- atoms in an arithmetic expression can be numbers or variables</p>
<p>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.<br></p>
<p>Philippe<br>
</p>