diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..12b9019 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2021 Thomas Lindner + +Permission to use, copy, modify, and distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b2f71ad --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +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 +```