3 ms·
Pratt parsers are elegant. I really like them. For those to whom they are new: I found them a little tricky to implement directly from Pratt's paper or even Cr
by pratt4the_win 1y ago
Pratt parsers are elegant. I really
like them.
For those to whom they are new: I found
them a little tricky to implement
directly from Pratt's paper or even
Crockford's javascript that popularized
them.
So, through trial and error I figured out how to
actually implement them in regular
languages (i.e. not in Lisp).
If it helps, examples in C and Go are here:
https://github.com/glycerine/PrattParserInC https://github.com/glycerine/PrattParserInC
https://github.com/glycerine/zygomys/blob/master/zygo/pratt.go https://github.com/glycerine/zygomys/blob/master/zygo/pratt....
I find them easier to work with than the
cryptic LALR(1) bison/yacc tools, but then
I never really felt like I mastered yacc
to begin with.