I was wondering how professional programmers create their own programming languages.
Do they only create a compiler which reads a text file and makes an executable out of it (considering there are no syntax errors etc)?
I'm not planning on creating my own programming language (I'm obviously too unexperienced for that) , I just wanna know how they do it.
You can just take a subset of an existing language or come up with a simple variation of it and get started. However, if you have plans for creating your very own programming language, you will have to give it some thought. I think of designing a programming language as divided two phases: The big-picture phase.
It's really difficult and it takes a lot of time to do so. Many languages are written one on the other, like C++ is written on C, but every language comes back to one, Assembler.
If you're interested, there's a great free course you can take on Udacity that will give you a good idea: https://www.udacity.com/course/cs262 (Programming Languages - Building a Web Browser). I'm not halfway through the course yet, but we've learned some interesting concepts as well as the foundations of lexical analysis. You might think a web browser has nothing to do with a programming language (I did), but actually, they do pretty much the same things except for compiling the code to executable form. They both have to read, parse, and lex code, and interpret it according to the specification of the language. JavaScript is also a pretty powerful language built into every modern browser (and many other 'languages' are interpreted by browsers now as well).
To give you another example, the inaugural implementation of Python was implemented in the C programming language. This allows python programs to make use of C source code. There is also a Java take on Python (jython) that interoperates with Java programs. What makes Python Python (if you ignore the batteries-included aspect of it) is the language specification which includes things like what are the reserved words, how objects are stored in memory, what kind of expressions and control structures are valid, etc. etc. I'm by no means knowledgeable enough to develop a 'serious' language like Python. But someone who is would have to develop it in another language. Even if you did have the ability to develop another language, you would have to have something special for it to become widely used, as there are thousands of programming language, many of which are considered hobby languages (for example, there are languages designed so that their source code will resemble a Shakespeare play, or a recipe).
You should read up on compiler construction. Some of the main areas include:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With