[antlr-interest] Seperating grammar and actions
"Paul Bouché (NSN)"
paul.bouche at nsn.com
Thu Mar 5 02:43:46 PST 2009
Hi Induh,
usually what people do is write an Abstract Syntax Tree (AST) grammar
which constructs an AST and then you can use different AST parsers which
have the different actions.
Or you could use try this
http://www.antlr.org/wiki/display/ANTLR3/Composite+Grammars
BR,
Paul
Indhu Bharathi schrieb:
>
> Hi,
>
>
>
> Is there a way to separate grammar and actions into two different
> files? This will be helpful when multiple people are working with the
> same grammar file (each might write their own actions for the same
> production) and don't want to create redundant copies of the grammar file.
>
>
>
> One way I thought was to implement observer pattern. The parser will
> be the subject and multiple observers can register to the same
> production and do different things. Another way would be to write a
> tool to separate the actions from the grammar file and reattach it.
> This way, actions can be separated out and maintained in a separate
> file and can be reattached when necessary and changes to grammar can
> be done in one centralized file.
>
>
>
> Is there any other way to do this? Any hint might be useful.
>
>
>
> Thanks, Indhu
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
--
Paul Bouché
Voice: +49 30 590080-1284
Nokia Siemens Networks GmbH & Co. KG, An den Treptowers 1, 12435 Berlin, Germany
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRA 88537
WEEE-Reg.-Nr.: DE 52984304
Persönlich haftende Gesellschafterin / General Partner: Nokia Siemens Networks Management GmbH
Geschäftsleitung / Board of Directors: Lydia Sommer, Olaf Horsthemke
Vorsitzender des Aufsichtsrats / Chairman of supervisory board: Lauri Kivinen
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 163416
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090305/8174a9bb/attachment.html
More information about the antlr-interest
mailing list