goto statement

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Tue Apr 26 19:13:09 EDT 2005


Tim Daneliuk wrote:
> OK - Here's some reasoning that may illuminate it.  We could, in
theory,
> reduce any language to the minimal Boehm & Jacopini control
structures
> (iirc there were only four).  In effect, anything beyond these is
> syntactic sugar.  IOW, feel free to use a minimalist Turing Machine
> to implement your next 100,000 line program.

Now, how does it go ...

#!/usr/bin/env python

_pc = 1
while True:
    if _pc == 1:
        # statement 1
        _pc = _pc + 1
    elif _pc == 2:
        # statement 2
        _pc = _pc + 1
    elif pc == 3:
        # statement 3
        _pc = 17       # GOTO 17
    elif pc == 4:
        # statement 4
        _pc = _pc + 1
    ...
    else:
        # Fallen off the end of our program.
        break




More information about the Python-list mailing list