Friday, July 31, 2009

What does it involve to create a new programming language?

What things do you need to understand? I realize it is difficult and all of that, but all I want to know is what you need to know, and how people usually do it. And any other info.





Thanks!

What does it involve to create a new programming language?
It's actually not difficult if you have all the correct tools and skills.





You need to come up with a requirements specification for your language... what does it need to do?





Use a formal syntax specification language to create a formal syntax for the new language.





Either generate a parser from the formal specification or write a parser. Get the syntax checking and error checking working.





If this is a compiled language, add functionality to emit the object code for the target hardware or linker. If it is interpreted, add functionality to execute the code.





Add optimizations if desired for speed or storage space.





It helps have some familiarity with formal languages, the assembly or object code of the target machine(s), the format of the intermediate files if the code will go through a linker, optimization strategies, etc. While it's complicated, it's subject matter that is normally covered at least in masters level computer science programs, if not undergrad.





The concepts show up in a lot of other contexts. For example, I've written an HTML parser and rendering engine that used a formal specification language and a parser based on the formal definition, not unlike I had used before to create compilers and interpreters.

flower pictures

No comments:

Post a Comment