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

Here is the most valuable exercise I can think of for language development: write a function that produces a formatted error string that renders the location of the cause of the error and the reason for the error. Once you have this, it will be much easier to write your compiler from the ground up because every step of the way you can validate that the compiler is only handling inputs that you it expect it to and rejecting everything else.

The error reporting function is not easy to write correctly, but a decent one can be written in fewer than 100 lines of lua (and I am certain it can be done in all but the least expressive languages in under 200).




I've been there before, got something working and then kept adding features until I went "Hey, this could be a library!". Never finished the library. Nor the language for that matter.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: