I need to scan if-then-else blocks and while loops
To: "Mike Stolnicki" <email@example.com>
Subject: Re: FLEX help
In-reply-to: Your message of Fri, 30 May 1997 13:33:27 PDT.
Date: Fri, 30 May 1997 10:46:35 PDT
From: Vern Paxson <vern>
> We'd like to add "if-then-else", "while", and "for" statements to our
> language ...
> We've investigated many possible solutions. The one solution that seems
> the most reasonable involves knowing the position of a TOKEN in yyin.
I strongly advise you to instead build a parse tree (abstract syntax tree)
and loop over that instead. You'll find this has major benefits in keeping
your interpreter simple and extensible.
That said, the functionality you mention for get_position and set_position
have been on the to-do list for a while. As flex is a purely spare-time
project for me, no guarantees when this will be added (in particular, it
for sure won't be for many months to come).