← Back to context

Comment by rhendz

6 years ago

What would be some cool use cases to design your own compiler?

There are various weird and wonderful niche languages out there, if you appreciate programming languages as an end in themselves. Two examples: Sentient [0] and Factor [1][2].

[0] https://sentient-lang.org/

[1] https://factorcode.org/

[2] Factor's home-page does a poor job of presenting examples to give a flavour for the language, so here's one on GitHub: https://github.com/factor/factor/blob/master/basis/roman/rom...

The simplest case where they prove useful is usually when your regex is longest than 20 characters. Write a parser once, and it'll be readable to people other than yourself (if it isn't your schema is bad)

A (not)compiler can be made to look for issues in your codebase that already exists. It would need all the tools of a compiler, just that the target is the same as the source language.