Loading ...
Sorry, an error occurred while loading the content.

while loop executing during tree walking

Expand Messages
  • toltec_spb
    I need to execute while loop, the parser rule is: while_ : WHILE^ LPAREN expression RPAREN DO (statement)* END ; my tree walker rules: while_ [bool OK] {
    Message 1 of 1 , Sep 8, 2002
    View Source
    • 0 Attachment
      I need to execute while loop, the parser rule is:

      while_ : WHILE^ LPAREN expression RPAREN DO (statement)* END ;

      my tree walker rules:

      while_ [bool OK]
      {
      VARIANT * pVal;
      }
      :
      #(WHILE LPAREN pVal=ex:expression RPAREN DO (ddo:statement[OK])*
      {
      while (pVal->boolVal)
      {
      orphan_statement(ddo,OK);
      pVal=orphan_expression(ex);
      }
      }
      END)
      ;

      orphan_expression returns [VARIANT * pVal] : pVal=expression;

      orphan_statement [bool OK] : (statement [OK])*;

      The "while_" rule is executed only one time :( What can I do with my
      tree parser to solve this problem?? beforehand thank's
    Your message has been successfully submitted and would be delivered to recipients shortly.