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

Another tip that helped my compiler. A compiler usually has passes which are optional (optimization) or things that can be done one or another way. Like a pass that can come befor or after another pass. Inputs that can be processed from left to right or right to left etc.. It is quick and easy to make flags for all these variants. Than run the integration tests with different flags.

Another tip, validation pass. If you have a (complex) data structure like an IR. Create a validation pass, which becomes the specification, of what exactly is legal in this data structure. This is like an assert on steroids.

And.. have a bigger use case at hand. Integration tests are great, but also have a real world case that can be run.




I like the idea of writing a validation pass, but I don’t want to pay a cost at runtime. This could be much to ask, but are there any programming languages which allow to write a validation pass which are enforced at compile time?


Move the invariants on the IR into the type system representing the IR. Then no validation pass involved. Requires an adequate type system.




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

Search: