[antlr-interest] language conversion

Monty Zukowski monty at codetransform.com
Tue Apr 6 09:43:06 PDT 2004


I wrote an AREV to VB translator.  Have a look at my article on it   
http://www.codetransform.com/fun_with_antlr.html.  Also see my notes on  
planning a translation project  
http://www.codetransform.com/planning.html.  Then be impressed and hire  
me to help :)

The basic strategy is to have two tree grammars, on for the input  
language and one for the output language.  Your parser builds the input  
tree.  Then you have however many tree rewrite passes it takes to morph  
the tree into the output format.  Typically analysis comes first, then  
a series of actual translations.  Finally you unparse the tree to a  
text file with your output source code.

Monty

www.codetransform.com
ANTLR translation services

On Apr 6, 2004, at 7:10 AM, ronald.petty at milliman.com wrote:

>
> Hi,
> If you couldn't tell I am trying to convert VB code to C.  However I  
> am having trouble deciding the best way to go about this using Antlr.  
>  I understand you make the lexer/parser.  However I am not sure what  
> point to do the translation to another language.  I realize that there  
> are things like varible scoping that will effect my translation, and I  
> am not sure where this kind of logic would go in the Antlr process.  
>  It seems there are several choices (parser, ast, tokenstream stuff,  
> etc).  I am still in the newbie/overwhelmed stage of all the Antlr  
> features.  
>
> Any advice?  (Besides don't use VB :) )
>
> Thanks
> Ron
> *********************************************************************** 
> ***************
> This communication is intended solely for the addressee and is
> confidential. If you are not the intended recipient, any disclosure,
> copying, distribution or any action taken or omitted to be taken in
> reliance on it, is prohibited and may be unlawful. Unless indicated
> to the contrary: it does not constitute professional advice or
> opinions upon which reliance may be made by the addressee or any
> other party, and it should be considered to be a work in progress.
> *********************************************************************** 
> ***************
>
>
> Yahoo! Groups Links
>
> 	• 	To visit your group on the web, go to:
> http://groups.yahoo.com/group/antlr-interest/
>  
> 	• 	 To unsubscribe from this group, send an email to:
> antlr-interest-unsubscribe at yahoogroups.com
>  
> 	• 	 Your use of Yahoo! Groups is subject to the Yahoo! Terms of  
> Service.
>
>  


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list