https://github.com/aquapi/zll1
I'm trying to write a LL(1) parser generator for Zig, similar to https://github.com/sinclairzx81/parsebox
I'm not sure how to implement recursive parsing and type inference with a similar DSL to Parsebox
Something like
const Parser = Module(.{
.Root = Union(.{
.end = Const(.end, "end"),
.next = Tuple(.{
Union(.{
.x = Const(.x, "x"),
.y = Const(.y, "y")
}),
Ref("Root")
})
})
}, "Root");
// Expected output type
const Root = union(enum) {
.end: @EnumLiteral(),
.next: struct {
union(enum) {
.x: @EnumLiteral(),
.y: @EnumLiteral()
},
*Root
}
}
I have tried and it only works if the output type is acyclic which is kinda useless for parsing purposes
Please suggest as many changes as u guys can (even rewriting the whole codebase is fine)
Not using a similar DSL is fine too as long as it is composable