Skip to content

hydrogen602/compiler

Repository files navigation

Compiler

This project attempts to create a custom language and a compiler for it that generates LLVM IR.

A few examples of the language can be found in fib.idk, fibR.idk, test.idk, and test.old.idk.

This project used to be focused on generating MIPS code, but now I've transitioned to trying to use LLVM to simplify things.

Currently the language features functions, recursion, if, else, and while statements. The only type currently supported is integers.

See comparison/README.md for speed comparisons. Currently it looks to be 35% slower than C.

How to run

Run make build to compile the compiler.

Run

cabal run compiler -- -i fibR.idk

to compile the fibR.idk. Then execute ./a.out to run the compiled code.

ToDo List

  • Enums on the heap
  • Reference counting incrementing
  • Emit llvm instructions for incr/decr reference counts - function calls are slow
  • Make performance tests for benchmarking against C and past/future versions

About

Trying to make a language and compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published