DEV Community

Discussion on: Creating a new programming language

Collapse
 
mcsh profile image
Sajjad Heydari

Thank you for your kind words!

I want to write this language, and then write the compiler within itself. Which will probably take longer than I like to admit, but I'm up for the challenge!

Collapse
 
gtanyware profile image
Graham Trott • Edited

It may depend on how close your language is to the one it's currently written in. Could be a lot of it is a relatively simple substitution exercise. Or not. I did this back in about 1985. I originally wrote my compiler (a variant of PL/M) in assembly-language then rewrote it in itself. High-level languages look nothing like assembler so the new version was structurally very different from the old. However, much of the time in developing the original had been spent designing the syntax and figuring out what it should do, so little of this effort was needed the second time around. I think the second iteration actually took a lot less time than the first.

If you're going for self-compilation you can limit the scope of the initial product to the minimum needed to compile itself. All other features can wait until you have self-compilation working, after which you're operating entirely in your own code. This should flush out errors very quickly and your debugging takes place in a simpler environment than if you wait for everything to be in place. Well, that was my experience, at least.