How do I process an if, elseif statement using the treeparser.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ram_Peri
Posted On:   Wednesday, May 4, 2005 04:48 PM

I have a grammar that look like. ( I am only showing snippets here) < Parser: startRule: (statement)* ; statement: INTEGER COLON^ rules; rules: ( rule )+; rule: LPAREN! condition APPLY^ action RPAREN! Lexter: COLON: ':' ; Problem: I want to do a left to right parsing. If a condition is true, I have to exeute the corresponding and should not look at any more rules. If a conditon is false, I should not execute the corresponding action and continue to the next condition, if it exists. My problem is equival   More>>

I have a grammar that look like. ( I am only showing snippets here) <

Parser:


startRule: (statement)* ;

statement: INTEGER COLON^ rules;

rules: ( rule )+;

rule: LPAREN! condition APPLY^ action RPAREN!






Lexter:

COLON: ':' ;



Problem:

I want to do a left to right parsing.

If a condition is true, I have to exeute the corresponding

and should not look at any more rules.



If a conditon is false, I should not execute the

corresponding action and continue to the next condition,

if it exists.


My problem is equivalent to

how can I implement an if elseif elseif ... statement

that does not have nesting.

   <<Less
About | Sitemap | Contact