4 ms·
There's another parser generator written in Forth, that I have personally used myself: Gray [1-3] The zip file [1] has english documentation, the papers [2,3]
by dvdkhlng 7y ago
There's another parser generator written in Forth, that I have personally used myself: Gray [1-3]
The zip file [1] has english documentation, the papers [2,3] are unfortunately only available in german.
This [4] is a mostly working grammar for the Verilog language written using Gray. It uses a lexer that sits on top of Gforth's regexp [5] package that directly compiles regexps into forth code (BTW quite a few bugs in the regexp package were triggered by the lexer and subsequently fixed upstream).
[1] http://www.complang.tuwien.ac.at/forth/gray4.zip http://www.complang.tuwien.ac.at/forth/gray4.zip
[2] http://www.complang.tuwien.ac.at/papers/ertl89.ps.gz http://www.complang.tuwien.ac.at/papers/ertl89.ps.gz
[3] http://www.complang.tuwien.ac.at/papers/ertl97.ps.gz http://www.complang.tuwien.ac.at/papers/ertl97.ps.gz
[4] https://sourceforge.net/p/fourhdl/code/HEAD/tree/trunk/parser.fs https://sourceforge.net/p/fourhdl/code/HEAD/tree/trunk/parse...
[5] https://github.com/forthy42/gforth/blob/master/regexp.fs https://github.com/forthy42/gforth/blob/master/regexp.fs
- siraben 7y agoHere's a toy parser generator I wrote that works for context-free languages[0]. [0] https://github.com/siraben/meta-yacc https://github.com/siraben/meta-yacc