A port of the Lemon Parser to Go.
This work was done entirely in support of
gopikchr. It works well enough
to turn pikchr.y
into pikchr.go
, but there are almost certainly
further bugs. Pull requests are welcome: I intend no support for this
project, but if you're obscure enough to want a Go port of the Lemon
Parser, then we share a strange kind of kinship, and I welcome your
contributions.
- Keep the code structure as close to the original as possible, to make tracking and applying future changes as straight-forward as possible.
- Convert to Go idioms only where the conversion remains clear.
- nsf/golemon - 11 years out-of date 😞. Went in the opposite direction: the parser generator is still written in C, but generates Go code
- You must define
func testcase(bool)
in your code. - The various
#define
s have been turned into constants.
- Use the embed package to embed the template in the binary.
- Create a github action that follows the rss feed for changes to
lemon.c
andlempar.c
and creates issues. - [ ] Figure out a better way to do constants: either put them in a separate file that is only (re)generated optionally, or make them settable with flags, or something. - Possibly, go back and incorporate the lessons learned from
porting
pikchr.y
to Go: use a[]byte
to represent the mainchar *
pointers and pointer arithmetic, instead of converting to[]rune
.