4 ms·
There were a few aims I wanted to meet: - Stick as closely as possible to the GLSL specification by using the reference grammar with minimal modification - Pr
by haxiomic 11y ago
There were a few aims I wanted to meet:
- Stick as closely as possible to the GLSL specification by using the reference grammar with minimal modification
- Produce a haxe version of the parser so I could do some haxe-compile-time magic with it
Haxe is fairly similar to javascript so I tried altering PEG.js to spit out haxe. The result was a 9000 line file which it turns out was too big to compile. ANTLR looked promising but it appeared to be a bit too much to work create a haxe port of the runtime.
Lemon was minimalistic and had a simple syntax which was fairly close to the syntax of the reference grammar. The core parser is only about 300 lines[0] and everything else is in data tables[1] which are generated by the lemon command line tool.
[0] https://github.com/haxiomic/haxe-glsl-parser/blob/master/glsl/parse/Parser.hx https://github.com/haxiomic/haxe-glsl-parser/blob/master/gls...
[1] https://github.com/haxiomic/haxe-glsl-parser/blob/master/glsl/parse/Tables.hx https://github.com/haxiomic/haxe-glsl-parser/blob/master/gls...