PyLogo: the Logo Language implemented in Python

Website: http://pylogo.org

How Logo is different from Python

Examples

In Logo:

? REPEAT 4 [FD 100 RT 90]
? PR [Hello world!]
Hello world!

The Python equivalent:

>>> from turtle import *
>>> for i in range(4):
...     forward(100)
...     right(90)
>>> print 'Hello world!'
Hello world!

Python Integration

Making a procedure available is easy:

# in turtle.py...
from turtle import forward
forward.aliases = ['fd']

; In logo...
? import "turtle
? FD 100

Even control structures are easy:

def logoWhile(interp, test, block):
    lastVal = None
    try:
        while logoEval(interp, test):
            try:
                lastVal = logoEval(interp, block)
            except LogoContinue:
                pass
    except LogoBreak:
        lastVal = None
        pass
    return lastVal
logoWhile.logoAware = 1
logoWhile.logoName = 'while'

This is the actual implementation of WHILE in Logo.