Skip to content
An implementation of Lua 5.1 in Zig, for learning purposes
Zig
Branch: master
Clone or download

README.md

Zua

An attempt at a Lua 5.1 implementation in Zig.

Goals, in order of priority:

  1. Learn more about Lua internals
  2. Learn more about Zig
  3. Anything else

Status

  • Lexer (llex.c/.h) -> lex.zig
  • String parsing (in Lua this was done at lex-time) -> parse_literal.zig (see 4324bd0 for more details)
  • Number parsing (in Lua this was done at lex-time) -> parse_literal.zig
    • Basic number parsing
    • Proper strtod-compatible number parsing implementation
  • Parser (lparser.c/.h) -> parse.zig
  • ...

Why Lua 5.1?

It's what I'm most familiar with, and I'm also assuming that 5.1 is simpler internally than more recent Lua versions.

Building / running

  • zig build to build zua.exe
  • zig build test to build & run all tests
  • zig build run to build & run zua.exe (does nothing right now)
  • zig build fuzz_lex to run lexer tests on a large set of inputs/outputs generated by fuzzing-lua
  • zig build bench_lex to run a benchmark of the lexer (this benchmark needs improvement)
  • zig build fuzz_strings to run string parsing tests on a set of inputs/outputs generated by fuzzing-lua
You can’t perform that action at this time.