I am building a grammar for a script language with parslet but I have
problems formulating it in such a way that error reporting works well.
I have tried to reduce the parser grammar, a small-ish example can be
found here:

http://pastie.org/private/fa6pufjukwp4x5hkgkueq

I apologize, it's still kind of lengthy but it illustrates my point
pretty well. When I drop the terminating ; from the input, the error
is reported at line 1, column 1 instead of after the last consumable
input with both error reporting engines. I suppose the reason for that
is that the entire outer rule failed and therefore nothing was
actually consumed. What I would really like to know is how I can
redevelop the grammar so that input errors can be reported as
accurately as possible.

Additionally, parsing 200 lines of the full script language takes
about 1 second on my 2 GHz i7, if anyone has pointers on optimising
the grammar for speed I would also be extremely happy.


Any help is greatly appreciated!
Henrik

Reply via email to