Steve
Steve

Reputation: 55

Bison c code assignment

If a loop structure is defined in *.y file as:

WHILE '(' expr ')' stmt ENDWHILE { //to be written here loop structure handling
- put WHILE into structure stack }

then - however I am forced to use ENDWHILE - how can I tie c code to ENDWHILE to check there is no overlap between structures?

Upvotes: 0

Views: 116

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 754530

The code in the braces in the example will only be executed when all the previous tokens and rules have been recognized (and any code executed).

If you have nested WHILE / ENDWHILE loops, the inner ones will be completed before the outer ones are.

Upvotes: 1

Related Questions