[antlr-interest] Porting ANTLR-Java-AST-Template based solution to ANTLR-C based solution

Kecman, Dejan Dejan.Kecman at tdsecurities.com
Tue Apr 22 07:53:35 PDT 2008


Hi,

I am new to ANTLR, so please be gentle and patient with me... I read book, I browsed through available examples, and after a while, I successfully created my grammar and Java version of parser/lexer that produces AST, and AST walker that uses templates for generating structured text.  It was not that difficult at all even for beginner in this area. But now, I want to port this to C/C++ world, and since templates are not supported in ANTLR-C runtime, I am stacked here.  So, my question is the following - what is the best approach to porting ANTLR-Java-AST-Template based solution to ANTLR-C based solution?  I was browsing through many examples, but most of them use "printf" for any output, and I need ANTLR based object to be part of bigger schema and used directly within my application code. In my templates I used mainly two forms:

templateOne( xxx ) ::=<<
Some text
<xxx>
Yet another text
>>

templateTwo( yyy ) ::=<<
Some text
<yyy:{yyy | More text <yyy>}>
Yet more text
>>

So, my question is - what is the best way to make this working in ANTLR-C based world?  I would appreciate any pointers and would really appreciate some example.

Thank you in advance and thanks for great tool


********************
NOTICE OF CONFIDENTIALITY
This communication including any information transmitted with it is 
intended only for the use of the addressees and is confidential. 
If you are not an intended recipient or responsible for delivering 
the message to an intended recipient, any review, disclosure, 
conversion to hard copy, dissemination, reproduction or other use 
of any part of this communication is strictly prohibited, as is the 
taking or omitting of any action in reliance upon this communication. 
If you receive this communication in error or without authorization 
please notify us immediately by return e-mail or otherwise and 
permanently delete the entire communication from any computer, 
disk drive, or other storage medium.

If the above disclaimer is not properly readable, it can be found at 
www.td.com/legal
                                                           
AVERTISSEMENT DE CONFIDENTIALITE                   
Ce courriel, ainsi que tout renseignement ci-inclus, destiné uniquement 
aux destinataires susmentionnés,  est confidentiel.  Si vous 
n’êtes pas le destinataire prévu ou un agent responsable de la 
livraison de ce courriel, tout examen, divulgation, copie, impression, 
reproduction, distribution, ou autre utilisation d’une partie de ce 
courriel est strictement interdit de même que toute intervention ou 
abstraction à cet égard.  Si vous avez reçu ce message par erreur ou 
sans autorisation, veuillez en aviser immédiatement l’expéditeur par 
retour de courriel ou par un autre moyen et supprimer immédiatement 
cette communication entière de tout système électronique.

Si l'avis de non-responsabilité ci-dessus n'est pas lisible, vous 
pouvez le consulter à www.td.com/francais/legale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080422/9856d985/attachment.html 


More information about the antlr-interest mailing list