Re: Kat's goto

new topic     » topic index » view thread      » older message » newer message

-------Phoenix-Boundary-07081998-

Hi David Cuny, you wrote on 2/7/02 1:25:33 AM:

>My issues with the GOTO are purely a matter of implemention. The basic
>idea
>behind coding the goto is fairly simple. You have a table that holds the
>position of the goto.

Euphoria's source code has a symbol table that can be used fairly
easily. Instead of a table of goto's, you have a series of symbols
that are linked to the label symbol.

>
>So, on a conceptual basis, implementing GOTO is fairly easy. The issue is
>whether the language itself will support it.
>...
> There may be design issues in Euphoria which make it next to
>impossible to implement a GOTO.

There could have been but there apperently aren't. (I seem to have
it working). It is easy to implement both conceptually and
practically.

>
>I suspect that a GOTO could be supported by keeping track of the nesting
>level that the label was on. When a GOTO was called, it would then EXIT
>until
>the correct nesting level had been arrived at, and then JUMP to the code.
>
>This would mean modifying the code for all the block structures (for,
>while)
>to support the new EXIT, adding code to keep track of how deep the nesting
>was at interpret and runtime, and tables for backpatching, etc. Not
>entirely
>trivial.
>

Not necessary. Emitting a simple 'op-code - dest address' instruction
does the trick. It is useful (and possible) to check the nesting level
and disallow branches into loops.

Karl Bochert

-------Phoenix-Boundary-07081998---

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu