0

I'm trying to write my own scripting language using flex and bison. I have a basic parser and I would like to add a for statement very similar to the C language for statement. It is not clear to me how to code the action associated to the for statement

Suppose I have the following production for the 'for' statement:

for_loop: FOR '(' assignment ';' condition ';' compteur')' '{' list_instructions '}' {;}

  • 1
    Perhaps you could provide a clue as to how this differs from any other statement you are trying to parse. – rici Feb 12 '21 at 01:06
  • You might find https://stackoverflow.com/questions/15600056/for-loop-semantics-in-bison-yacc or https://stackoverflow.com/questions/19200808/parsing-a-while-loop-in-bison/19201452#19201452 useful – Chris Dodd Feb 12 '21 at 01:43

0 Answers0