Skip to content
An implementation of the Logo (turtle graphics) language in ocaml
OCaml JavaScript HTML Makefile Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sample_programs
.gitignore
Makefile
README.md
cairographics.ml
index.html
jquery.console.js
lexer.mll
logo.ml
logoturtle.ml
logoweb.ml
make_gallery.py
parser.mly
webgraphics.ml

README.md

A Logo Interperter in Ocaml (and Javascript)

A tree created in Logo

Try the interperter in your browser

Visit http://cmaes.github.io/logoturtle/

See this page for sample programs and their graphical output.

Installation

The following directions describe how to install the dependencies for running the code locally.

Install OCAML

Use the Real World OCAML installation instructions https://github.com/realworldocaml/book/wiki/Installation-Instructions

On Linux

$ sudo add-apt-repository ppa:avsm/ppa
$ sudo apt-get update
$ sudo apt-get install curl build-essential m4 ocaml opam

Then do

opam init
eval `opam config env`

On Mac

Install Homebrew http://brew.sh.

brew install ocaml
brew install opam

Then do

opam init
eval `opam config env`

Install ocamlfind

opam install ocamlfind

Install the Cairo Ocaml bindings

https://github.com/Chris00/ocaml-cairo

opam install cairo2

Install Dependencies

opam install core
opam install menhir
opam install lwt

Install js_of_ocaml

opam install js_of_ocaml
opam install js_of_ocaml-camlp4

Building the Logo Interperter

There are two different builds of the interperter:

  • A interpreter that runs from the command-line and uses Cairo as backend to output .png files from Logo programs

  • A interpreter that runs from Javascript and uses a Canvas backend to output graphics from Logo programs in the browser

Building the Command-line Interpreter

Issuing the following command to build both.

make

will build and run a program called logo.native. It creates a file named tree.png that should contain a tree.

To clean up do

make clean

Building the Javascript Interpreter

Issuing the following command

make logoweb.js

will build a Javascript library containing the interpreter. The file index.html shows how this library may be used from Javascript via the interpetLOGO command.

Logo Grammar

I made my own up. But there is one here

You can’t perform that action at this time.