/cljcc

Toy C compiler implemented in Clojure

Primary LanguageClojureEclipse Public License 1.0EPL-1.0

cljcc

A toy C Compiler implementation in Clojure.

Follows the book Writing a C Compiler by Nora Sandler.

Prerequisites

Only Linux and Mac OS is supported. For Windows, run through WSL.

Tasks

To see all available tasks in the project, run bb tasks:

bb tasks
The following tasks are available:

clean         Removes target folder.
run-main      Run main
build-uberjar Builds uberjar
run-uberjar   Run uberjar
build-native  Builds native image

Build

To build native image, run:

bb build-native

This produces a binary cljcc at /target/cljcc. Pass the path to the C file.

./target/cljcc/cljcc "path/to/file.c"

Run

bb run-main "path/to/file.c"

References

Some talks / projects which helped in implementation.