Compiler theory - Introduction (a)

 

  • Before a program can be run, it was first translated into a form that can be executed by the computer
  • Complete the translation of software called a compiler

Language Processor

  translater

  • A compiler is a program that can be written in the source program, the program is translated into the equivalent of a
  • One of the important tasks of the compiler is to report it in the source code found in the process of translation errors

  

  Run the target program

  • If the target is an executable machine language program, then it can be invoked by the user, processes the inputs and generates outputs

   

  Interpreter

  • Common language processor, does not generate the target program by way of translation
  • From the user's perspective, the interpreter directly connected with the user to provide an input source program performs operations specified

    

 

  Compilers and interpreters Disadvantages

  In the process of mapping the user input to an output of

  • It consists of a compiler machine language object program generated usually much faster than an interpreter
  • Error diagnostic effect interpreter is usually better than the compiler , source program statement is executed one by one because it

  Java language compiler and processor combines the interpretation process

  • A first compiled into Java source code called a byte code (bytecode The) intermediate representation
  • Then be a virtual machine by the bytecode obtained interpreted
  • The advantage is compiled from a machine on the bytecode in interpreting and executing on another machine
  • Through the network  can be completed migration between machines

  

  • In order to complete input to output more quickly to deal with, some are called in-time compiler to run in the middle of the Java compiler handles the input of a moment first to translate the byte code into machine language before , and then execute the program

 

  • A source may be divided into a plurality of modules , and stored in a separate file
  • The source aggregated together by one task is sometimes referred to as pre-processor (Preprocessor)  program independently, preprocessor (Preprocessor) responsible for macro converts abbreviated form of the source language sentence
  • After the preprocessed source passed as input to a compiler, the compiler may generate an assembly language program as its output, since the assembler language and is easier to debug output
  • The assembly language program is called by the assembler (Assembler)  processing program and generates machine code relocatable
  • Large programs are often divided into a plurality of partially compiled , may be relocatable machine code necessary and other relocatable object file and library file are connected together to form the code running on the real machine
  • The code of a file may point to the location of another file, and linker (linker) can solve the problem of external memory address
  • Loader (loader) to all executable object filesinto memory

  

Guess you like

Origin www.cnblogs.com/YC-L/p/12105231.html