add license and readme

development
Thomas Lindner 2023-01-06 15:03:55 +01:00
parent f4ed3e2754
commit 6937c243ed
2 changed files with 49 additions and 0 deletions

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2021 Thomas Lindner <tom@dl6tom.de>
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.

36
README.md Normal file
View File

@ -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
```