Hacker News new | past | comments | ask | show | jobs | submit login
The Naked Truth About Writing a Programming Language (2014) (digitalmars.com)
31 points by todsacerdoti on May 16, 2020 | hide | past | favorite | 3 comments




Having started a serious programming language, I am finding truth in writing the parser myself. I started with ANTLR, and while it helped me go fast, it is slowing me down now in some features. For instance, sane error messages are an exceptionally hard problem.

I'm finding wisdom is stopping on the first parse error because if you try to fix those on the fly, then you are just creating more junk. It is better to make parsing super fast and done up-front because then you don't waste your time debugging non-issues.

Once parsing happens, the same philosophy applies to type checking. Spool out the first error within a sub-tree, and move onto the next sub-tree.


> Most compilers’ follow on messages are so bad that the practical programmer ignores all but the first one anyway.

Because the only reason I would build a new programming language is only for it to not be worse than others?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: