It is possible to write NQP's precedence parser in Raku

Viewed 100

I'm trying to figure out how I can rewrite NQP's Precedence Parser in Raku :

The Precedence Parser is implemented here: https://github.com/Raku/nqp/blob/master/src/HLL/Grammar.nqp#L384 NQP should be a subset of Raku but the Grammar part seems to be specialized.

If I want to rewrite the Precedence Parser in EXPR() in Raku instead, what would be the Raku Grammar primitives to use? I.e. What would cursor_start_cur() translate to? is there a cursor in a Raku Grammar? How can I set pos of a Raku Match object ? What would $termcur.MATCH() translate to, etc...

I am not searching for different ways of writing a Precedence Parser, but rather want to know whether it can be done in Raku in the same way that NQP does it.

1 Answers
Related