|
|
||
|---|---|---|
| .forgejo/workflows | Add a basic CI step | |
| awk-scripts | Don't use clear in conway.awk | |
| benchmarks | Improve benchmarking script, add benchmark results plotting | |
| src | Fix memory leak | |
| submodules | Add external projects' submodules | |
| tests | Print basic stack trace on runtime errors | |
| .gitignore | Improve benchmarking script, add benchmark results plotting | |
| .gitmodules | Add external projects' submodules | |
| build.zig | Drop use of more deprecated functionality | |
| build.zig.zon | Release v0.1.2 | |
| LICENSE | license: update copyright years | |
| README.md | Improve benchmarking script, add benchmark results plotting | |
dawk
WIP implementation of POSIX AWK in Zig.
Originally named phos/pawk; however, there are a bunch of awk and awk-adjacent projects called pawk, so it was renamed to dawk instead (I failed to find any other project using this name). The "d" does not stand for anything in particular.
Warning: here be dragons, may eat both your homework and your dog
Goals
From most to least important:
- Have fun, and learn! I started this project to learn a new language and to actually implement a language for once, and I've gained so much knowledge in the process while still having a blast! The other stuff is important but this is my number one priority for this project.
- Be standards-compliant; follow POSIX (specifically POSIX 2024) as much as reasonably practicable
- Avoid dependencies as much as possible; outside of standard stuff like the C POSIX library, any extra dependencies must be carefully considered
- Be simple and performant, self-explanatory
Requirements
- A POSIX operating system and environment
- Zig 0.15.x toolchain
- libc headers
- Python (optional, for integration tests)
- kcov (optional, for integration test coverage)
- Gnuplot (optional, to plot benchmark results)
Building
$ zig build # debug build
$ zig build -Doptimize=ReleaseFast # or ReleaseSafe or ReleaseSmall
This installs the dawk binary to zig-out/bin.
Testing
dawk uses a combination of unit tests and (mostly) integration tests. To run them:
$ zig build test
To regenerate integration tests' expected stdout and stderr:
$ tests/integration -u
For more information about the integration tests runner, run tests/integration -h.
Inspirations
Over the course of working on this project, there are a few projects and resources that I've constantly referenced and learned from, namely:
- Crafting Interpreters by Bob Nystrom Excellent resource for anyone looking to dip their toes into language development
- Numbat by David Peter I maintained Numbat for a bit (and before that, its predecessor, Insect), and both have played a very big role in nurturing my interest in programming language implementation and development
- goawk by Ben Hoyt The resolver and virtual machine instruction, among other things, are heavily inspired by goawk's
Thanks to the authors of all of these!
License
Licensed under the MIT LICENSE, see LICENSE.