Hi,
The subject sounds more complicated than my problem is:
I have an AST that results from a quite simple language. Now we want to 
transform that language to C++-code using ANTLR and string templates as 
proposed in the books. 
Since our language ist not static (keywords are stored in a database and not 
directly in the parser) transformation should be done by enriching the AST with 
the coresponding code fragments for a statement in the source language. A 
C++-Function will retrieve the translation from the database.
Q1: Is this a good way to go in this case? 

Since the AST creation is done in a C++ application we cannot use database 
access when running the transformation using string templates. The 
transformation is made by a seperate program and the AST is handed over as a 
string.
Q2: If enriching the AST with the code translation for every statement is the 
way to go: Should the additional node (that for the code) created by an 
arbitrary action or is there a better way?

To make things a bit clearer here is a short example:
Input language:
Motor einschalten
Fahrzeug beschleunigen

Target language:
Simulator.Engine(EngineOn);
Simulator.Speed_up();

Regards
Heiko
Mit freundlichem Gruß

Heiko Folkerts

-- 
_______________________________________________________

DAVID Software GmbH · Wendenring 1 · 38114 Braunschweig

Tel.: +49 531 24379-14
Fax.: +49 531 24379-79

E-Mail: mailto:[email protected]
WWW:    http://www.david-software.de

Eintragung: Amtsgericht Braunschweig, HRB 3167
Geschäftsführer: Frank Ptok 
_______________________________________________________

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to