Compile Time D Expression Parser?

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Mar 11 11:02:06 PDT 2012


On 11-03-2012 18:54, d coder wrote:
> Hello  Philippe
>
>     OK, doing a bit of thread necromancy here (3 weeks, still acceptable
>     here?)
>
> You are more than welcome. I am still working on the stuff.
>
>     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?
>
> That would be sufficient for a start. But later I would also like to
> parse simple D style if-else conditionals and foreach loops.
>
>     You do realize that any parse tree will for these constructs will be
>     quite deep, right? I mean, 10-levels deep or somesuch.
>
> 10 levels would be good enough.
>
> Regards
> - Puneet
>

Pegged should have no problem parsing all of D, at least theoretically 
(I don't know of any severe ambiguities in D). So IOW, it can probably 
do what you need it to do.

-- 
- Alex


More information about the Digitalmars-d mailing list