Hello,
I found the toy.o2bas in projectA\ToyInterp and the discussion about it here:
http://www.oxygenbasic.org/forum/index.php?topic=1094.msg9241#msg9241The demo did not run with the latest version of o2 and the error message was rather meaningless:
ERROR: Unknown type
WORD: long
LINE: 942
FILE: main source
PASS: 1
so I commented out the #lookahead directive and tried to arrange the procedures from bottom up, following the error messages when running the demo. This worked until I came to sub primary(), which calls expr() which calls primary() ..., also if_stmt() and while_stmt(), which call stmt_seq() which calls if_stmt() and while_stmt() ....
I am not sure if such constructions are legal. At least there is a great chance to create endless loops. Therefore I personally will prefer the bottom up strategy. After inserting the code of primary() into expr() and inserting the code of if_stmt() and while_stmt() into stmt_seq() the demo finally worked.
Then I tried to do this procedure of inserting with the original code of toy.o2bas but this seems not to be sufficient. I got a similar message like before.
So my question is: what are the rules for using #lookahead? Is there any advantage for using this directive?
Roland
.