2
1
Fork
You've already forked dawk
2
No description
Zig 64.7%
Awk 32.8%
Python 2%
Shell 0.4%
triallax 07b44845bf
All checks were successful
/ ci (push) Successful in 1m41s
Fix memory leak
2025年12月25日 02:17:37 +00:00
.forgejo/workflows Add a basic CI step 2025年11月30日 19:46:16 +00:00
awk-scripts Don't use clear in conway.awk 2025年11月30日 19:46:36 +00:00
benchmarks Improve benchmarking script, add benchmark results plotting 2025年12月02日 22:23:53 +00:00
src Fix memory leak 2025年12月25日 02:17:37 +00:00
submodules Add external projects' submodules 2025年11月30日 17:45:50 +00:00
tests Print basic stack trace on runtime errors 2025年12月25日 02:17:37 +00:00
.gitignore Improve benchmarking script, add benchmark results plotting 2025年12月02日 22:23:53 +00:00
.gitmodules Add external projects' submodules 2025年11月30日 17:45:50 +00:00
build.zig Drop use of more deprecated functionality 2025年12月21日 23:34:13 +00:00
build.zig.zon Release v0.1.2 2025年12月07日 22:28:43 +00:00
LICENSE license: update copyright years 2025年02月03日 14:18:30 +00:00
README.md Improve benchmarking script, add benchmark results plotting 2025年12月02日 22:23:53 +00:00

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:

  1. 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.
  2. Be standards-compliant; follow POSIX (specifically POSIX 2024) as much as reasonably practicable
  3. Avoid dependencies as much as possible; outside of standard stuff like the C POSIX library, any extra dependencies must be carefully considered
  4. 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.