Is it possible to develop compilers in any language?

Source: Internet
Author: User

Is it possible to develop compilers in any language?

Today is thinking about a problem, after all, after learning the compilation principle for a period of time, the compiler in the end can be developed by which language?

We all know that the compiler is usually divided into the following five phases:
1) Lexical analysis
2) Syntax Analysis
3) Semantic Analysis and intermediate code generation
4) optimization
5) Target code generation

Of course, the most difficult point is the generation of the target code, this phase of the final translation is to really translate the original code into a CPU can be directly computed by the machine code (nativecode).


On the internet, some netizens say that the first compiler of C language is written by B language, because C language is a new language designed on the basis of B Language.

But B language is a language modified by a language, of course, B language compiler is certainly a language generated, that a? Infinite recursion, There is always a place to End.

That is the assembly language, assembly language written out the first simple compiler, and then this compiler to generate a compiler, and constantly generate new compilers, and constantly discard the old compiler, so that the compiler more and more mature, the more

The more useful it is.

This is the following sentence:

Machine compilation, A,a born b,b born C,c Life.

Theoretically speaking, what language can be written out of the compiler, but the problem of efficiency, because after many steps of translation, have been translated into machine code, some steps, low efficiency, some steps less, high efficiency, of course, I

We are using this kind of high efficiency.


In fact, I was wondering why the compiler could be generated again with the newly generated compiler, such as C-c compiler, when assembly language generated a simple compiler?

This is a recursive thought, for example, I see it.

A large mold can be used to generate a mold, a mold can be made to b-mold, and then push down, and finally this small mold can be made to small boxes for loading things.

The first big mold must be hand made out of the first mold, but with this large mold, the back can be used by his automatic generation of more molds, the back of the various molds added up and can be made more sophisticated molds,

so, when the first big mold made out of the mold, the big mold can be discarded.

Is it possible to develop compilers in any language?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.