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

Jan Suchotzki jsuchotzki_work at web.de
Tue Aug 6 01:22:22 PDT 2002


 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/ 



More information about the antlr-interest mailing list