1. RE: Well I did it! (variable_id, etc..)
- Posted by Mike <vulcan at win.co.nz> Nov 26, 2004
- 547 views
Greg, 2.5a uses an integer variable to track the depth of nests, ie: parser.e integer stmt_nest -- nesting level of statement lists This variable is incremented at the start of Statement_list() and decremented at the end of it. Obviously RC doesn't seem to need anymore info. In my own parser I track the depth with a sequence that is appended/truncated as needed. I can scan the sequence at any time to see exactly what sort of loop the parser is in at any point. It would be simple enough to add this to the code (largely because Rob has made it so easy!). Mike PS: You'll probably need a dual nest stack to track the construct type and variable (if any) in the case of for-loops - for really fancy jumps, like out of several loops etc.. Greg Haberek wrote: > > > > Looks pretty intuitive to me! > > Um... kinda. In my opinion, the next statement should act like an exit > statement, only instead of leaving the loop, it jumps back to the top > and increments the counter when needed (for vs while). The problem is, > I don't know if I'm in a for or a while loop. I wish I could explain > it better, you'd understand if you've studied the source code as much > as I have in the past few days... What you're offering would be nice > to have, but it looks like it could get a bit messy (internally, that > is). > > ~Greg >
2. RE: Well I did it! (variable_id, etc..)
- Posted by Mike <vulcan at win.co.nz> Nov 26, 2004
- 531 views
Mike wrote: > > > Greg, > > 2.5a uses an integer variable to track the depth of nests, ie: > > parser.e > integer stmt_nest -- nesting level of statement lists Uh, this one too: integer loop_nest -- current number of nested loops Mike
3. RE: Well I did it! (variable_id, etc..)
- Posted by "Kat" <gertie at visionsix.com> Nov 26, 2004
- 571 views
On 26 Nov 2004, at 7:01, Mike wrote: > > > Mike wrote: > > > > > > Greg, > > > > 2.5a uses an integer variable to track the depth of nests, ie: > > > > parser.e > > integer stmt_nest -- nesting level of statement lists > > Uh, this one too: > > integer loop_nest -- current number of nested loops Makes goto look easy, eh? Kat