lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Tony Finch <dot@dotat.at> writes:
> LPEG is brilliant for small parsing tasks. Its main weakness is that it
> doesn't provide much help for error reporting and recovery. If the
> context of the code ensures that you don't have syntax errors,
> e.g. machine-generated strings or other tools to check for errors, then
> LPEG can get you a long way.

I use LPEG to parse "human input" stuff, and haven't found it to be
_that_ hard to offer basic error reporting, using periodic
synchronization tokens in the grammar, and a small set of convenience
functions (mapping string positions to line numbers, etc)...

It would be nice if LPEG provided a little more support, of course, but
even as it is, I think it's completely practical to use LPEG for
traditional parsing tasks that need error handling.

-Miles

-- 
Joy, n. An emotion variously excited, but in its highest degree arising from
the contemplation of grief in another.