An attempt to build a compiler in C.
Steven Oud 580d760b5a bitwise shift oprators | пре 9 година | |
---|---|---|
examples | пре 9 година | |
src | пре 9 година | |
tests | пре 9 година | |
.gitignore | пре 9 година | |
LICENSE | пре 9 година | |
Makefile | пре 9 година | |
README.md | пре 9 година |
Erupt is my attempt at building a compiler in C. This project is for learning purpose only and should not be used in production.
A simple hello world program may look like this:
use io;
fun main
{
io::writeln("Hello world");
}
Installing Erupt requires some dependencies:
llvm-config
in your $PATH
gcc
, clang
)make
$ git clone https://github.com/soudy/Erupt
$ cd Erupt
$ make
Or if you wish to use a non-default C compiler:
$ CC=compiler make
(where compiler
is the compiler of choice).
Erupt has been tested and proven to work with gcc
5.2.0 and clang
3.6.2 on
x86_64 GNU/Linux, but most other C compilers with C99 support should work.
This will create the binary bin/erupt
. If you wish to install erupt
into
your path, run make install
with superuser privileges.
$ erupt [options] file
-o, --output
set output name (default: main)
-v, --version
show version
-V, --verbose
verbose mode
-t, --tokens
show generated token stream
-n, --nodes
show nodes of the generated AST
-h, --help
show this