问题描述:

I'm new to programming.. But I would like to know how programming languages begin; I'm a Windows os user, and everything seems so vast. So, my question is, how do programmers get from that blank screen, to building their own programming language.

Also, are many new languages made? And are any made home-brewed?

网友答案:

I don't totally understand your main question, but I can tell you that new programming languages are made every month :-) A lot of them never see the (public) light and a lot are very very specific to a smaller domain. But exact statistics are not available.

A list can be found on Wikipedia.

网友答案:

To come up with a new programming language, you first need to come up with its formal grammar. Using the formal grammar you decide things like e.g. whether your true/false variable will be called bool or boolean or Boolean (over-simplified example).

Once the grammar is in place, you write a program in a known programming language which uses the rules of the grammar to take lines of code as input and produce machine executable code as output. Such a program is called a compiler. The machine executable code is usually specific to the machine it will run on e.g. if its an intel processor, then your compiler needs to produce intel compliant assembly language.

So the most essential Computer Science courses that you need to take before designing your own language are Computer Architecture, Automata Theory and Compiler Construction, then you need to learn a few things about the assembly language of the hardware on which you plan to run your programs and finally a low-level programming language like C which can help you write your new compiler.

网友答案:

To write a program you need a program!

Here's what you do: 1) Decide what your language will look like (the grammar) 2) Write a parser (turn the text the programmer types into a parse tree) 3) Turn the contents of the parse tree into the ones and zeros that your target CPU understand. 4) Package this all up into the executable files your OS expects.

相关阅读:
Top