Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
104 lines (85 sloc) 4.11 KB
A compiler for the Grace language.
Minigrace compiles Grace to C and JavaScript. The compiler is written in
Grace itself. It supports most of the specified language to date: for
details on current language feature support see <doc/errata>.
Minigrace should work on POSIX-compliant systems, and is known to work
on Linux, NetBSD, and Mac OS X. It requires a properly-configured GCC on
the path, which may require installing development tools.
The Git repository is capable of bootstrapping itself with `make`, but
it is recommended to bootstrap from a recent tarball and is required on
some platforms. Running tools/tarball-bootstrap will provide
instructions on finding and using this tarball.
A tarball distribution can be compiled using `./configure` and `make`.
After building there will be a `minigrace` executable in the root. This
executable supports a few different modes and options:
- Execute a script in the simplest way possible:
./minigrace file.grace
In most cases, this command will be all that is required.
- Produce a native executable:
./minigrace --make file.grace
This mode produces an executable called "file".
- Describe what it is doing while it goes:
./minigrace --verbose [...]
- Use another backend:
./minigrace --target js -o file.js file.grace
There are also other targets for specialised purposes. Use
--target help to list them.
- Set the location of the standard Grace library code to link against:
./minigrace --gracelib path [...]
- Disable static type checking:
./minigrace -XIgnoreTypes [...]
- Enable tail call support:
./minigrace -XTailCall [...]
The resulting output will be generated in the same directory as the
input. The minigrace executable may be located elsewhere, and will find
its support files alongside itself.
Some other Makefile targets may also be of interest:
- make test
Runs the test suite. All tests are expected to pass; if any do not,
please send the tests/test.log file to the author.
- make js
Builds the web frontend and JavaScript compiler, as used on
<>. The frontend is accessible
in js/index.html. Note that in general the file must be served over
HTTP for the test cases to load. The JavaScript back- and front-ends
are suitable for quick testing, but have some limitations compared to
the native compiler, and particularly do not support Unicode in any
Platform notes
On Mac OS X, Xcode is required to compile. The environment must be set
up to ensure that gcc and ld are in the path and that GCC is able to
compile C code. Setting the following environment variables is known to
be required in many cases:
The script c/environ-Darwin attempts to detect and set up these
variables correctly.
Under Cygwin, only building from a tarball is currently supported. All
builds will be static, because of limitations in dynamic libraries in
the PE format.
No backend or platform provides foreign functions or access to the
underlying platform. Manual platform glue code may be possible to bind
particular functionality; see <doc/interop> for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <>.
Although the compiler by nature reproduces portions of its own code in
its output, as a special exception, incidental reproduction of any part
of its source code by the compiler as part of compiling any other
program does not require that program to adhere to the terms of the GPL.
You are free to remove this exception from any version of the compiler
you have modified.
Jump to Line
Something went wrong with that request. Please try again.