A Logo interpreter with dynamic scope, shallow binding, tail call optimization, Lisp 1.5 style FUNARG's, and first class continuations. Mostly Ucblogo compatible.
C C++ Perl Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
ffft
tests
ucblogo
.gitignore
COPYING.ContinuingLogo.txt
COPYING.Garbage.Collector.txt
COPYING.ucblogolib.txt
INSTALL
INTERNALS
Makefile.in
README.md
TODO
audio.cpp
audio.h
byte_buffer.c
byte_buffer.h
config.h.in
configure
configure.ac
conservative_gc.c
copying_gc.c
declarations.pl
get_apply_parts.h
global_environment.c
global_environment.h
initialize.txt
interpreter.c
interpreter.h
io.c
io.h
list_memory.c
list_memory.h
logoinitialize.txt
logoreader.c
logoreader.h
main.c
main.h
ms_gc.c
pcgc.h
reader.c
reader.h
structures.c
structures.h
treeify.c
treeify.h
trig.h
ttymodes.c
ttymodes.h
turtles.cpp
turtles.h
ucblogolib.txt
valgrind.parse.suppressions.sh
valgrind.txt
weak_cons.c
weak_cons.h
wxui.cpp
wxui.h

README.md

ContinuingLogo

ContinuingLogo is a Logo interpreter that is mostly compatible with Ucblogo. It successfully runs minimally modified versions of Brian Harvey's Pascal compiler and Student program from volume 3 of Computer Science Logo Style.

It also supports FUNARG's, which are kind of like lexical closures, but they are closed over the dynamic environment instead of the lexical environment. These were in Lisp 1.5, but they have not been implemented in many recent languages.

For example:

? to addx :y
>   output :x+:y
> end
? to makeclosure
>   output function [[z] addx :z]
> end
? to makeadder :x
>   output makeclosure
> end
? make "add5 makeadder 5
? print invoke :add5 2
7
?

When makeclosure calls function, it captures the dynamic environment, including the value of x from makeadder.

First class continuations are supported, as is McCarthy's ambiguous operator. For example:

? to foo
>   localmake "x (amb 1 2 3)
>   localmake "y (amb 4 5 6)
>   if :x*:y <> 15 [fail]
>   print :x
>   print :y
> end
? foo
3
5
?

The garbage collector is precise, tracing, incremental, and portable. It knows nothing about the structure of Logo objects. Callbacks are used for following the pointers within objects.

INSTALLATION

ContinuingLogo uses autoconf. With any luck, the following may work:

$ ./configure; make; make install

RUNNING

Normal usage:

$ clogo

EXAMPLES

To run the pascal compiler:

$ cd ucblogo/
$ rlwrap clogo
? load "pascal
Loaded
? compile "tower
<printout of pascal program as it is compiled>
? prun "tower
<moves to solve the Tower of Hanoi>

To run the student example:

$ cd ucblogo/
$ rlwrap clogo
? load "student
Loaded
? student :radio
<printout of the solution of a mathematical word problem>

LICENSE

Most of the interpreter is released under version 3 or later of the GNU General Public License.

The Logo library procedures in ucblogolib.txt are from Ucblogo and are covered by version 2 or later of the GNU General Public License.

The garbage collector is released under version 2.0 of the Apache License.

LIMITATIONS AND INCOMPATIBILITIES COMPARED TO UCBLOGO

  • The reader and the treeifier use recursive descent parsers written in C. They can be crashed with pathologically long or deep structures.

  • There is no support for getter/setter notation, or GLOBAL.

  • No TEST/IFTRUE/IFFALSE.

  • No TAG/GOTO.

  • Slot number variables only go up to ?10.

  • There is no RUNPARSE. Lists are only parsed once. [a+b] is a list with three items.

  • Backslashed characters do not keep any special properties. There is no BACKSLASHEDP.

  • SETITEM behaves the same as .SETITEM behaves. It does not check for cycles.

  • LOCAL will not work inside of templates run with APPLY, INVOKE, FOR, etc.

  • There is no PENREVERSE.

  • There is no PALETTE/SETPALETTE. Color commands take rgb lists, with each value ranging from 0-255.

  • There is no SETPENPATTERN/PENPATTERN. (These are NOPs on several ucblogo platforms as well.)

  • There is no SETSCRUNCH/SCRUNCH.

  • SAVEPICT/LOADPICT use PNG format. There is no EPSPICT.