Go to file
Thomas Lindner fb3de57c08 uppercase typenames, lowercase identifiers 2023-01-13 00:09:14 +01:00
bootstrap uppercase typenames, lowercase identifiers 2023-01-13 00:09:14 +01:00
test uppercase typenames, lowercase identifiers 2023-01-13 00:09:14 +01:00
.clang-format fail on parsing errors 2023-01-05 21:12:15 +01:00
.clang-format-include simple compiler (most intermediate language generation missing) 2023-01-04 23:32:55 +01:00
.editorconfig simple compiler (most intermediate language generation missing) 2023-01-04 23:32:55 +01:00
LICENSE correct year 2023-01-06 15:22:14 +01:00
README.md add license and readme 2023-01-06 15:03:55 +01:00
meson.build simple compiler (most intermediate language generation missing) 2023-01-04 23:32:55 +01:00

README.md

A toy language compiler.

Build dependencies

  • ANTLR4
  • Meson
  • Ninja
  • C++ compiler

Runtime dependencies

  • ANTLR4 C++ runtime
  • QBE
  • Assembler (the one in the C compiler will do)

Build steps

meson setup builddir
ninja -C builddir

The xc binary is in builddir/bootstrap/xc. Optionally install it with

ninja -C builddir install

Usage

Use xc to compile xlang to QBE intermediate langage

xc -o foo.ssa foo.x

Use qbe to optimize and emit assembly

qbe -o foo.S foo.ssa

Assemble and link the binary (easiest to let the C compiler figure it out)

cc -o foo foo.S