[bitc-dev] Quick haskell question

Sandro Magi naasking at higherlogics.com
Thu Aug 12 07:45:53 PDT 2010


On 2010-08-12 9:06 AM, Ben Karel wrote:
> 
> I agree, it's a shame that it's not taught or talked about much, and
> instead we're taught to mangle our grammars, ending up with e.g.
> Python's 14 productions dedicated to encoding precedence. I first saw
> operator precedence parsing presented in Chris Lattner's Kaleidoscope
> tutorial for LLVM. It took me a while to appreciate just how useful the
> idea was, but kudos to Chris for including it in the tutorial.

There are many operator precedence parsers. Top Down Operator Precedence
parsing, aka a "Pratt Parser", is also particularly simple [1], and
easily replaced an unwieldy C# combinator parser library.

However, as far as I know, the precedence of the operators must be
static, not dynamic. Jonathan earlier specified that precedence is
dynamic. Depending precisely what that means, it might rule out these
precedence algorithms.

Sandro

[1]
http://higherlogics.blogspot.com/2009/11/extensible-statically-typed-pratt.html



More information about the bitc-dev mailing list