re2c is a lexer generator that supports Zig as an output target (among other more obvious languages like C and Rust and Go and JavaScript). It does not support Ruby, alas.
See also: