[antlr-interest] Fwd: Mapping ANTLR grammar to XML

Bart Kiers bkiers at gmail.com
Fri Feb 19 11:14:21 PST 2010


On Fri, Feb 19, 2010 at 5:13 PM, Ketan Maheshwari <
ketancmaheshwari at gmail.com> wrote:

> ...
>
> For instance the following assignment statement :
>
> in = ["t1 hyde"%patient:"mr hyde", "t1 argan"%patient:"mr argan"]
>
> is equivalent to the following xml:
>
> <source name="in" type="String">
>         <array>
>             <item><tag name="patient" value="Mr Hyde" />T1 Hyde</item>
>             <item><tag name="patient" value="Mr Argan" />T1 Argan</item>
>         </array>
> </source>
>
> The tagnames and elementnames are not important as such but the fact that
> they map as per the tree structure and the process is automated.
>

Have a look at "rewrite rules":
http://www.antlr.org/wiki/display/~admin/2008/04/11/Rewrite+rules

Regards,

Bart.


More information about the antlr-interest mailing list