https://github.com/jsfpdn/yatlc
yet-another-toy-language compiler
https://github.com/jsfpdn/yatlc
compiler llvm zig
Last synced: 5 months ago
JSON representation
yet-another-toy-language compiler
- Host: GitHub
- URL: https://github.com/jsfpdn/yatlc
- Owner: jsfpdn
- Created: 2023-03-11T19:14:12.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T05:36:55.000Z (over 2 years ago)
- Last Synced: 2025-04-07T07:16:35.092Z (12 months ago)
- Topics: compiler, llvm, zig
- Language: Zig
- Homepage:
- Size: 623 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yatlc: yet-another-toy-language compiler
> This is a repository for the yatl compiler, a project for a compiler course.
> yatlc is written in [Zig 0.11.0](https://ziglang.org) and uses LLVM.
**yatl is an imperative, statically typed, lexically scoped and memory-unsafe language.**
Sample code can be found in the [`/examples`](/examples) directory.
See [DOCS](./DOCS.md) for more information.
**yatlc is a single-pass compiler**. The recursive descent parser does not explicitely
build the abstract syntax tree but directly emits the LLVM IR.
## Building yatlc
To build the compiler, run `zig build`, emitting `./zig-out/bin/yatlc` binary.
## Running yatlc
To see help, run `./zig-out/bin/yatlc --help`.
To compile a yatl program, run `./zig-out/bin/yatlc path/to/file.ytl -o binary_name`.
## Testing `yatlc`
To run tests, run `zig test src/tests.zig`.
When testing an unexpected compiler error, it is helpful to build yatlc with `zig build -Doptimize=debug`
to emit more information during runtime when something happens.