|
Boost Users : |
Subject: Re: [Boost-users] [Spirit] seeking help with AST tree generation
From: Jens Weller (JensWeller_at_[hidden])
Date: 2009-06-13 15:34:09
> Hello,
>
> Using Boost Spirit, is it possible to write a grammar that, out of the
> box, generates the AST tree according to cases below:
>
> Case 1:
> =======
>
> Input:
>
> 1 < 2 AND 3 < 4 OR 5 < 6
>
> Resulting tree:
>
> OR
> / \
> AND 5 < 6
> / \
> 1 < 2 3 < 4
>
>
> Case 2:
> =======
>
> Input:
>
> 1 < 2 AND (3 < 4 OR 5 < 6)
>
> Resulting tree:
>
> AND
> / \
> 1 < 2 OR
> / \
> 3 < 4 5 < 6
>
>
>
> In other words, I want to honor the parenthesis for expression grouping.
>
>
> How would you recommend doing it?
Please refer to the spirit mailinglist:
Spirit General Mailing List <spirit-general_at_[hidden]>
Also you should take a look at the calc examples, also the AST XML generation is maybe valid for you.
regards,
Jens Weller
-- GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und Telefonanschluss für nur 17,95 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net