An attempt to build a compiler in C.

Steven Oud 580d760b5a bitwise shift oprators 9 年 前
examples 69ee18e3f4 keywords rename and parser eat fix 9 年 前
src 580d760b5a bitwise shift oprators 9 年 前
tests 84230f026c order does no longer matter in symbols struct in the lexer 9 年 前
.gitignore 63f8c9aee8 organizing, build location changed and parse example 9 年 前
LICENSE 6ec78b2843 first stage (lexical analyzer) 9 年 前
Makefile 566f0943ac updated `llvm-config --cflags` enables -Wwrite-strings, so make it shut up 9 年 前
README.md e602a89056 char data type and reworked line number in error messages 9 年 前

README.md

Erupt

Erupt is my attempt at building a compiler in C. This project is for learning purpose only and should not be used in production.

Example

A simple hello world program may look like this:

use io;

fun main
{
    io::writeln("Hello world");
}

Installation

Installing Erupt requires some dependencies:

Dependencies

  • git
  • LLVM >= 3.6 installed and llvm-config in your $PATH
  • a C and C++ compiler (eg. gcc, clang)
  • GNU make

Building

$ 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.

Run

$ erupt [options] file

Options

-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