Golemon
A Go port of the lemon parser generator
Install / Use
/learn @gopikchr/GolemonREADME
Go lemon port
A port of the Lemon Parser to Go.
State
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.
Goals
- 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.
See also
- nsf/golemon - 11 years out-of date 😞. Went in the opposite direction: the parser generator is still written in C, but generates Go code
Changes
- You must define
func testcase(bool)in your code. - The various
#defines have been turned into constants.
TODOs
- [ ] Use the embed package to embed the template in the binary.
- [ ] Create a github action that follows the rss feed for changes to
lemon.candlempar.cand 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.yto Go: use a[]byteto represent the mainchar *pointers and pointer arithmetic, instead of converting to[]rune.
