Creating a programming language

I was wondering how professional programmers create their own programming languages.
Do they only create a compiler that reads a text file and outputs an executable file from it (given the absence of syntax errors, etc.)?

I do not plan to create my own programming language (I'm obviously too inexperienced for this), I just want to know how they do it.

+5
source share
3 answers

If you're interested, there is an excellent free course that you can take at Udacity that will give you a good idea: https://www.udacity.com/course/cs262 (Programming languages ​​- creating a web browser). I have not yet completed the course, but we have studied some interesting concepts, as well as the basics of lexical analysis. You might think that the web browser has nothing to do with the programming language (I did), but in fact they do almost the same thing, except compiling the code into an executable form. Both of them must read, analyze and Lex code and interpret it in accordance with the specification of the language. JavaScript is also a fairly powerful language embedded in every modern browser (and many other "languages" are now interpreted by browsers).

, Python C. python C. Java- Python (jython), Java-. Python Python ( , ) - , , , , .. .. , "" , Python. - . , - , , , - (, , ).

+3

. :

+3

, - , " ". , , .

. , , . , .

, , "". , . , , " ". , .

" " , CPU , "". , , "" . C ++ - .

, - . C, Python. , , , .

, , , :

  • / . ( , , .)
  • , , .

Typically, the syntax for a domain-specific language is chosen to make the first step unusually simple. A syntax is selected that is very close to an existing language, so the programmer can reuse an existing parser, or the syntax is chosen specifically to make the language very easy to parse.

The second step, as a rule, is quite trivial, although some language features can significantly complicate the situation.

+2
source

All Articles