[antlr-interest] translating a language to C/C++

mzukowski at yci.com mzukowski at yci.com
Tue Aug 6 07:54:10 PDT 2002


You might get some ideas by reading my paper on the AREV to VB translator I
wrote.  http://www.codetransform.com/fun_with_antlr.html.

I'm also available as a consultant to get you moving quickly.

If step one is done by another parser then that parser just needs to
construct an AST that antlr can understand.  Then you will be able to use
antlr's cool tree grammar and tree building functionality to massage your
source code into your target language.

Monty

> -----Original Message-----
> From: Jan Suchotzki [mailto:jsuchotzki_work at web.de]
> Sent: Tuesday, August 06, 2002 1:22 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] translating a language to C/C++
> 
> 
>  Hi everyone,
> 
> I'm new to ANTLR and would like to build an translator. It 
> has to translate
> a companys internal composition language (you can think of it 
> like IDL) into
> C and most probably to C++.
> I found a message from Thu Feb 14, 2002 where Terence Parr 
> says the following:
> 
> >1) Parse the old input file, constructing a tree representing the
> >structure of the input and constructing a symbol table (that 
> may have to
> >be saved and used across parses/translations).
> >
> >2) Manipulate the tree (intermediate form) in multiple passes using a
> >tree grammar, slowing morphing it towards your target language.
> >
> >3) When you think that your intermediate form is very close to the
> >target language then you can do a simple walk of the tree 
> spitting out
> >text again. Each action in the grammar does a small bit of 
> the work and
> >you pray that the emergent behavior results in valid output text. ;)
> 
> Can anyone give me a more detailed insight into step 2? I 
> already searched
> the internet and the manuals but I don't understand how to do 
> this. Some
> hints where I can find more information would be very good.
> 
> What happens if step 1 is already done by another parser?
> 
> Many thanks and best regards
> 
> Jan Suchotzki
> ______________________________________________________________
> ________________
> Die witzigsten E-Mail-Adressen der Welt! Schon ab 2 Zeichen!
> Jetzt auswählen unter 
http://digitaledienste.web.de/MyAdress/?mc=021101


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list