Compilation process is divided

- lexical analysis

  • Constituting the source string is scanned and decomposed identified one word, such as the basic word (begin, end, if, for, while), identifier, constants, operators, and delimiter (punctuation, left and right parentheses )

- 2. parsing

  • On the basis of lexical analysis, according to grammatical rules of the language, the word grammar symbol string broken down into various types of units, such as "phrase", "sentence", "block" and "procedures".
  • Top-down recursive descent parsing comprises predictive analysis and analysis

- 3. Semantic Analysis

  • There is no check on the source semantic error, the type of collection of information in the code generation phase

- 4. The intermediate code generation

  • After performing syntax analysis and semantic analysis phase of the work described above, some compiler source program into an internal representation form, and register allocation.

    • Pros: in favor compiler portability
    • Common intermediate code are: postfix, ternary type, quaternary tree and formula

- The code optimization

  • The previous stage of the intermediate code generated by conversion or transformation is intended to enable more efficient target code generation, i.e., save time and space saving

- 6. The object code generation

  • This task is to stage the intermediate code into an instruction code on the absolute or specific machine code instructions or assembly instructions relocatable code specific machine and its associated

- Error Handling

  • Dynamic semantic errors

    • You will not find logic errors at compile time
  • Static semantic errors

    • It refers to the error found at compile time

Guess you like

Origin www.cnblogs.com/south-wood/p/12444501.html