Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's fairly straightforward to offer some functionality in this area with hand-written recursive descent parsers.

For example, a language with a C-like syntax, you'll often be parsing a sequence of statements separated by semi-colons (a block). If a statement fails to parse, you can just consume tokens until you hit the next semi-colon and then try to continue to parse statements from there.

Fairly crude approaches like this are easy to implement (at least with recursive-descent) but can be surprisingly effective. It's easy to construct counter examples where an approach like this will get it wrong but in practice it's hugely more useful to the poor user than just abandoning the parse completely.



You can probably make your heuristic even more robust, by looking at hints from indentation and parens and braces in addition to just semicolons.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: