I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2011-10-04 15:46:04.801232-07 by wilson
How to do better error reporting

I have the same question as szabgab posted years ago. No one responded to his post ... Hope I have better luck here.

I'm using RecDescent to parse a C-like language(a small subset of C: not pointer, only integer type, no struct, no #include, etc.). With some experience with lex/yacc/yacc++, I got the grammar correctly working in relatively short time. But I cannot figure out how to implement syntax error reporting and recovery. Especially tricky is to report syntax error in optional items (e.g. c_statement(s?)). I managed to get it working using <commit> and <error?>, and <resync> in a very small test case, but I find my approach not scalable to larger grammar. Most examples found on-line are using <error> in the top-most rule. Not sufficient for a C-like language. Want to know:

* Any example of error handling in a larger/deeper grammar out there?
* Maybe RecDescent is not intended for implementing C-like compiler?
* If I'm not using the right tool, any recommentation of another CPAN package for my purpose?

Thanks!!!
Wilson

Direct Responses: Write a response