3 ms·
I started making a language, and I took many shortcuts. I just parse my language, translate it to C, and use C compiler errors. I don't add new semantics, I j
by jokoon 11mo ago
I started making a language, and I took many shortcuts.
I just parse my language, translate it to C, and use C compiler errors.
I don't add new semantics, I just add many things like strings, map, etc to make it usable and fast.
I don't know if it's a good idea and how difficult this will be.
- Rohansi 11mo agoNothing wrong with that - some others do it too. You can even use TCC to do quick test builds and only use Clang/GCC for release builds.
- lukan 11mo ago"I don't know if it's a good idea and how difficult this will be." It is a great idea, if you want to learn about languages! (But if money is your goal, you may want to reconsider)
- shakna 11mo agoChicken Scheme compiles to C, using a method that ended up as a maths paper (Cheney on the MTA). Its a valid approach.
- 0x3444ac53 11mo agoOne day I aspire to be able to fully comprehend Cheney on the MTA. I kinda get it? But I've never learned C, and never had to slog through manual memory management, so it's a little lost on me
- dunham 11mo agoYou're in good company. The original C++ compiler translated to C. Haskell translates to C--. That sounds like a good approach, concentrate on the things you want to do/learn and let the C compiler pick up the rest. You can then be finished, add to your front end, or start replacing the backend. My language compiles to Javascript. I wanted to concentrate on the frontend tasks like type checking and elaboration, and I wanted a web playground (the language is now self-hosted). Javascript got me a runtime with closures and garbage collection for free.
- alcover 11mo agoI am also doing this. Like you i guess I want a nicer C. I produce my own errors though because it's better for the user.