All Projects → nojb → tortuga

nojb / tortuga

Licence: other
An implementation of the Logo programming language in OCaml

Programming Languages

ocaml
1615 projects
Standard ML
205 projects
Makefile
30231 projects

Tortuga - a Logo implementation in OCaml

Tortuga is an implementation of the Logo programming language in OCaml. It aims to support the language as specified by the Berkley Logo. It is distributed under the MIT license. It is currently under development but it is already functional for simple examples (see below).

Contact: Nicolás Ojeda Bär <[email protected]>.

Installation

Tortuga allows for different graphical backends. The most basic one is provided by OCaml's Graphics module, but it is quite poor. A better option is to use Vg to produce beautiful PDF files. (A javascript-based backend to see the pictures in a web browser is in the works.)

opam install uutf otfm gg vg ounit pa_ounit
cd ~/tmp
git clone https://github.com/nojb/tortuga
cd tortuga
make

Now you can run tortu.byte to start the interpreter.

Example

The Fern

Type the following in a fresh session of the interpreter:

to fern :size :sign
  if :size < 1 [ stop ]
  fd :size
  rt 70 * :sign fern :size * 0.5 :sign * -1 lt 70 * :sign
  fd :size
  lt 70 * :sign fern :size * 0.5 :sign rt 70 * :sign
  rt 7 * :sign fern :size - 1 :sign lt 7 * :sign
  bk :size * 2
end
clearscreen pu bk 150 lt 90 fd 90 rt 90 pd
fern 25 1 render

The last command, render, produces the actual pdf file. Don't forget to call render if you want to see your images!

Output

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].