dcsimg
Executing a treeparser rule based on the result from another rule,
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nagarajan_G
Posted On:   Thursday, August 6, 2009 10:11 AM

I am newbie to ANTLR, with a little information that i have i don't know how to execute statement(rule) based on the result from the condition(rule), Following is the pseudocode of treeparser, statement : if_stat |expr ; expr : add| assign ; if_stat scope nnLangCondStatus; @init { printf("IFSTATEMENT--> "); } : ^( IF_BLOCK c_status=condition (s=statements)*) { if($c_status.res == ANTLR3_TRUE ) { printf("Execute if block statements "); $nnLangCondStatus::cond_status = true; } } ; I want to execute statement rule based on the   More>>

I am newbie to ANTLR, with a little information that i have i don't know how to execute statement(rule) based on the result from the condition(rule),

Following is the pseudocode of treeparser,

statement
:
if_stat |expr
;

expr
:
add| assign
;
if_stat
scope nnLangCondStatus;
@init {
printf("IFSTATEMENT-->
");
}
:
^( IF_BLOCK c_status=condition (s=statements)*)
{
if($c_status.res == ANTLR3_TRUE ) {
printf("Execute if block statements
");
$nnLangCondStatus::cond_status = true;
}
}
;
I want to execute statement rule based on the return result from condition rule. How better I can do this, Pls suggest.

   <<Less
About | Sitemap | Contact