3 ms·
What would be some cool use cases to design your own compiler?
by rhendz 6y ago
What would be some cool use cases to design your own compiler?
- MaxBarraclough 6y agoThere 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/ https://sentient-lang.org/ [1] https://factorcode.org/ 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/roman.factor https://github.com/factor/factor/blob/master/basis/roman/rom...
- caditinpiscinam 6y agoSentient looks neat! Does it use the same strategies as Prolog under the hood?
- MaxBarraclough 6y agoGood question, I'm afraid I don't know enough about either language to answer that. The Sentient pages mention Prolog, for what that's worth: https://sentient-lang.org/intro/declarative https://sentient-lang.org/intro/declarative
- satthrow 6y ago> The MiniSat solver is Sentient’s default. It is a version of MiniSat that has been compiled to JavaScript with Emscripten. This means that it can run in a web browser and it does not have any dependencies when run from the command-line.
- sethhovestol 6y agoA (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.
- mhh__ 6y agoThe 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)
- MaxBarraclough 6y agoSeems a pity to throw out the various advantages of the high-level solution just because your regex engine doesn't support a scalable syntax. Advanced regex systems such as the Ragel parser-generator support a composition-friendly syntax, [0] but the average regex system doesn't, and I guess there's no quick fix for that. [0] http://thingsaaronmade.com/blog/a-simple-intro-to-writing-a-lexer-with-ragel.html http://thingsaaronmade.com/blog/a-simple-intro-to-writing-a-...