[antlr-interest] source code formatter

Loring Craymer lgcraymer at yahoo.com
Sat Jul 25 02:22:35 PDT 2009


You need to combine a tree walker with StringTemplate for output.  The tree walker can reflect high-level semantic concepts in its productions (declarations, method/function calls, etc.) that the depth first visitor cannot.  StringTemplate helps in rearranging tokens, adding syntactic sugar, etc. and your templates can be organized to suit the productions of the tree walker.

--Loring




>
>From: sgoto <samuelgoto at gmail.com>
>To: antlr-interest at antlr.org
>Sent: Friday, July 24, 2009 12:17:43 PM
>Subject: [antlr-interest] source code formatter
>
>Hi,
>
>
>   I am having a hard time using tree grammars for source code formatting/beautifier for language X. Are tree grammars actually meant to help me with source code formatting or am I better off with depth first visitors ?
>
>
>   By reading Terrence's post about how translators should use tree grammars makes me want to use it, it seems to be addressing the issues I have with visitors for translators, but I am not sure if it will help me much with formatters.
>
>
>   ideas ?
>
>-- 
>f u cn rd ths u cn b a gd prgmr !
>


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090725/0000d165/attachment.html 


More information about the antlr-interest mailing list