Hacker News new | past | comments | ask | show | jobs | submit login

You can't do those things using a parser generator. They not a part of the grammar.



In ANTLR4, they are most definitely not part of the grammar which they were in previous ANTLRs. That makes the grammar easier to read/change/reuse/... Everything else is listener and visitor methods which are easy to write, debug, error check, ....


You could theoretically put all kinds of meta-information into the grammar, even arbitrary code snippets that are pasted into the generated parser. I'm not saying that that's a good idea - it undermines much of the value of a parser generator - but generally speaking it can be done.




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

Search: