PEG in Go
Jul 28, 2011 at 7:15PM
I've been working on a PEG
parser in Go. PEG parsers are very similar
to traditional CFG parsers but unambiguous and (generally) easier to write.
The library can be found here.
I put together a basic example which parses simple mathematical expressions
and evaluates them. It's crude but it does work:
There are two things I'd like to get working next:
- Add a .compile method which will let you parse PEG syntax instead
of having to specify all the rules as Go calls
- Come up with a way to make processing expression trees easier
But I may not get to all that.