The structure of the compilation system

The structure of the compilation system

Compilation can be understood as translation to a certain extent, so I use an example of English to Chinese translation to explain the structure of the compilation system

eg :I went to school by bus.

If you ask everyone to translate, I believe you will be able to translate it soon, but what is the translation process like?

  1. First, we analyze I are personal pronouns, Wentworth is a verb, to is a preposition, School is a noun, by a preposition, Bus is a noun (This step is what we call lexical analysis ( Semantic lexical the Analysis ) )
  2. Then we analyze, verb + preposition (went to) can constitute a verb phrase, preposition + noun may constitute a prepositional phrase (by bus), (we call this step parsing ( syntax the Analysis ))
  3. Finally, we analyze, I usually as a personal pronoun as subject, went to a predicate, school as an object, by bus as a complement. (This step is what we call semantic analysis ( Semantic the Analysis ))
  4. Finally, we can translate English ( source language ) into Chinese ( target language )

Compiler structure diagram

Through the above example, we should be able to visually understand the compilation process
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_44823898/article/details/107997454