[antlr-interest] Trying to implement a while loop using embedded actions in ANTLR

Kevina Choolhun kevina.choolhun at gmail.com
Tue Jun 3 02:38:39 PDT 2008


Hello everybody,

I am new at antlr and have been trying my hand at embedding actions to try
make a while_loop work...

Here is part of my code.

whileStatement
@init{ evaluate = false;}
@after{evaluate=true;}

:
        'while' c1 = cond
            {$c1.value == true}?=>
            {while !($c1.value==true)
            {

            evaluate=true;}
                stat+
             }
             'endwhile'


 It works fine apart from the
("major") fact that it does not iterate, i.e. It enters the loop if
condition is true, process the actions inside the loop and exits, even if
condition is still true...

I have run out of ideas.. well, i am new at antlr and may be missing an
important point somewhere.

Can someone please counsel?

Thank you for your help.

Kevina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080603/9e57ef6e/attachment.html 


More information about the antlr-interest mailing list