Arc Lisp to C compiler
Arc C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
arc2c-tests
LICENSE
NOTES NOTES: some documentation changes May 9, 2008
README README: random doodles Jun 6, 2008
a2c.c a2c.c: corrected garbage collector handling of T_KFN and T_LKFN Jul 31, 2008
a2c.h
arc2c.arc
closures.arc
codegen.arc xe, codegen: fixed bugs related to 'symeval Jul 31, 2008
cps.arc cps, codegen: now adds a tag for continuation functions Jul 23, 2008
in-global.arc Added global function inlining Apr 9, 2008
lib-ac.scm.arc Added support for 'apply Jun 8, 2008
make-eval.arc Minor change in naming of function Jun 6, 2008
rm-global.arc Added support for 'apply Jun 8, 2008
sharedvars.arc
structs.arc Changed quote AST: quoted field is now in separate 'val field Apr 9, 2008
utils.arc Unused globals are now removed Apr 7, 2008
xe.arc

README

                _
    .-.   --\  /    arc2c
   /   \  --/  \_

This is the Arc to C compiler.

Arc is the new Lisp from Paul Graham (http://arclanguage.org). It's 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 in Arc. 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 numerical operations on fixnums (+, -, *, <, >, <=, >=, 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 cons cells construction, deconstruction and comparison (cons, car, cdr, is, isnt). All values can be printed with pr or prn. Unicode is supposed to be fully supported. The language supports first class continuations (with ccc) and is tail-recursive/tail-call-optimizing. Memory is managed via a home-made GC.

The let, set, sref, and fn syntaxes are partially implemented.  quote and if syntax are fully implemented. Symbols, numbers, and cons cells of symbols, numbers and cons cells can be quoted. Primitive operations cannot be overriden. If you call an undefined global function, the compiled program will silently crash (many but NOT all such errors are caught by the compiler). Some primitive operations expect certain type guarantees and do not check for correct types. There are probably bugs in every part of the program...

Use freely, at your own risk. If you want to improve the tool with us, 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.