add license and readme
This commit is contained in:
parent
f4ed3e2754
commit
6937c243ed
13
LICENSE
Normal file
13
LICENSE
Normal 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
36
README.md
Normal 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
|
||||||
|
```
|
Loading…
Reference in a new issue