[antlr-interest] Newbie ANTLR question

inyoursadmachine mwisner69 at comcast.net
Tue Dec 14 12:05:28 PST 2004




Hi,
I'm using ANTLR to write an interpreter for a C-like language. I 
finally got Parser.startRule() to run and Parser.getAST() returns 
the data below for the following source code:

source:

$name1 = "batman"
$name2 = "robin"
if($name1 == "catwoman")
{
	$name3 = "the joker"
}


ast: 
 ( = $name1 "batman" ) ( = $name2 "robin" ) ( if ( == 
$name1 "catwoman" ) ( COMPOUND_STATEMENT { ( = $name3 "the 
joker" ) } ) )

My question is how do I process a statement at a time from the AST? 
Or is this even the correct approach?  Can I do this from my tree 
parser or do I need custom code for this?

Thanks in advance,
Matt









 
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