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

Fundamentally I don't think parsing is a problem that's complex enough to warrant a custom tool and language. And even if it was Yacc is the wrong tool for the job in most cases.

Since most languages are context-sensitive, you almost always have to bend Yacc, which is designed for context-free languages, out of shape to apply it.

It's a hammer but we hardly have any nails, and the nails can just be pushed in by hand without a hammer, and they're the wrong type of nails anyway so that hammer isn't really compatible, and top of that it's a really expensive hammer.



Isn't the context sensitivity handled when you build an AST with the action statements in Yacc?


Yes - so straight away you have to leave the DSL and bypass the formal mode of Yacc. At which point why bother with it? If the first thing you need to do with your tool is hack around it, maybe the tool isn’t so well-designed?

And actions often do things like side-effect changes to the lexer state, so it gets worse from there.




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

Search: