No description
  • Zig 81.8%
  • Awk 14.4%
  • Python 2.4%
  • Shell 0.7%
  • C++ 0.4%
  • Other 0.2%
Find a file
triallax 44368d2494
All checks were successful
/ ci (push) Successful in 2m37s
Update test outputs
2026-02-22 08:03:57 +00:00
.forgejo/workflows Use UTF-8 instead of C wide characters, switch to the re2 regex library (#199) 2026-02-09 00:26:35 +01:00
awk-scripts Use UTF-8 instead of C wide characters, switch to the re2 regex library (#199) 2026-02-09 00:26:35 +01:00
benchmarks Polish up benchmarking harness 2026-01-27 00:10:23 +00:00
src Drop print_field_zero, make print* print $0 if count == 0 2026-02-22 07:33:30 +00:00
submodules Refresh submodules 2026-02-18 23:13:17 +00:00
tests Update test outputs 2026-02-22 08:03:57 +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 Add lto build option, disable by default 2026-02-10 01:28:01 +00:00
build.zig.zon Release v0.2.1 2026-02-21 23:32:44 +00:00
LICENSE license: update copyright years 2025-02-03 14:18:30 +00:00
LICENSE.allyourcodebase_grpc Use UTF-8 instead of C wide characters, switch to the re2 regex library (#199) 2026-02-09 00:26:35 +01:00
LICENSE.cre2 Use UTF-8 instead of C wide characters, switch to the re2 regex library (#199) 2026-02-09 00:26:35 +01:00
LICENSE.zig-simdutf Use UTF-8 instead of C wide characters, switch to the re2 regex library (#199) 2026-02-09 00:26:35 +01: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.