RE: Implementing Goto
- Posted by kbochert at ix.netcom.com Feb 12, 2002
- 513 views
-------Phoenix-Boundary-07081998- Hi David Cuny, you wrote on 2/12/02 12:46:24 AM: >Here's an attempt to implement a GOTO statement in Euphoria. It doesn't >work >(yet), but it's a start. Hopefully people can help me out here. I haven't >seen the latest release of the Euphoria source, so perhaps there are some >answers in there, too. > >The grammar is: > > LABEL <label> > GOTO <label> > > ... As you may know, my grammer is: :label: goto label I think the surrounding ':'s make the label more visible and just look more like a label. Should you wish to try this syntax (hope) it is no more difficult. It just involves having the scanner recognize the ':' character as a token, instead of recognizing the keyword 'label' (faster too!). The label statement code insists on seeing the trailing colon. If you don't like my syntax, thats ok, but please don't reject it because of implementation. What you're doing seems bascally very similar to my code. One significant difference, perhaps, is that I explicitly prevent the use of goto at the file level. I didn't want to think about what happens when the code jumps around the definition of a subprogram. There may be some differences between code in subprograms, which is compiled for later execution, and code at file level, which is executed as it is parsed? -------Phoenix-Boundary-07081998---