Skip to content
sacado edited this page Sep 12, 2010 · 17 revisions

This is the Arc to C compiler.

Arc is the new Lisp from Paul Graham (http://arclanguage.org). Its official release is currently implemented as an
interpreter above mzscheme.

Here, we are trying to make a compiler translating Arc code to C code, written both in Arc and C. The goal is to see if (and how) a
dynamically typed language conceived for exploratory programing and protoyping can be compiled efficiently. The current
implementation is based on a tutorial proposed by Marc Feeley : The 90 Minute Scheme to C compiler
(http://www.iro.umontreal.ca/~boucherd/mslug/meetings/20041020/minutes-en.html).

Currently, the compiler implements some numerical operations on Fixnums and Flonums (+, -, *, <, >, <=, >=, is, isnt), comparison on
Symbols (is, isnt), comparison on Characters (is, isnt, <, >, <=, >=), comparison and modification on Strings (is, isnt, sref),
Annotations (type, rep, annotate) and ConsCells construction, deconstruction and comparison (cons, car, cdr, is, isnt). HashTables are currently implemented very naïvely but are under active development.

All values can be printed with pr or prn. Unicode is fully supported. The language supports first class
Continuations (with ccc) and is tail-recursive/tail-call-optimizing. Memory is managed via a home made GarbageCollector.

The let, set, sref, quote, fn and if syntaxes are partially implemented. Symbols, numbers, and cons cells of symbols,
numbers and cons cells can be quoted. Primitive operations can be overriden. If you call an undefined function, the
program will silently crash. There are probably bugs in every part of the program…

Not implemented yet : Macros, ErrorHandling, InputOutput and a few interesting extensions not existing yet in the official release : FFI, CommandLineArguments.

Use freely, at your own risk. If you want to improve the tool with us, or want more information on anything, just send mail to sacado.sacado@gmail.com.

To use the compiler, in arc :

(load “arc2c.arc”) (compile-file “foo.arc”)

Notes about the compiler’s output code is available in the NOTES file.