How is precedence handling implemented?

22 views
Skip to first unread message

Ian Tegebo

unread,
Dec 20, 2016, 3:04:17 PM12/20/16
to marpa parser
In reading "Precedence parsing made simpler" [1], I went to look for how to rewrite a grammar "into an 'order-explicit grammar'".  I haven't had any luck finding a satisfying explanation.  Any pointers?  That said, I'm curious about Marpa's particular approach - would someone be kind enough to point me to code/docs/papers?

For context, I've been implementing an Earley parser for educational purposes.  I'm wondering how to deal with associativity and precedence.  While rewriting the grammar apparently does the job, I wonder how one reports a syntax error.  I'd prefer to point to a grammar rule, but once the grammar is rewritten it may not make sense to the user.

Jeffrey Kegler

unread,
Dec 20, 2016, 3:25:19 PM12/20/16
to Marpa Parser Mailing LIst
The top-level Marpa page shows precedence written w/o using Marpa's explicity precedenced statements: http://search.cpan.org/~jkegl/Marpa-R2-3.000000/pod/Marpa_R2.pod

To report errors, you have to track where the rewritten statements came from, and report the error in terms of alternatives in the user's original statements.

Hope this helps, jeffrey

--
You received this message because you are subscribed to the Google Groups "marpa parser" group.
To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages