On the java virtual machine | Series 1 | Architecture Overview

Today opened a special topic. We talk about the java programmers face every day java virtual machine (jvm).

Essentially, jvm two parts: a compiler (compiler) and runtime (runtime).

The so-called compiler, in simple terms, he is a machine translation, English translation is like the human world, an analogy, English translation, his main job is to translate Chinese into English.

The compiler, its main job is to programmers to write java code (like: Chinese) translation into class files (like: English). Like a programmer with the virtual machine translator.

The operation, which is mainly an execution machine, in simple terms, it is to load the class file and translate it into a more bottom assembly language and machine code, and the underlying operating system function call according to program logic to complete the program runs .

Principle that the compiler, is kind of how it?

In simple terms, it consists of two parts: the language parser and lexical analyzer.

What is a lexical analyzer?

Lexical analysis (lexical analysis) is a sequence of characters in the computer science convert word (Token) sequence of the process. Lexical analysis program or function is called lexical analyzer (Lexical analyzer, referred Lexer), also called a scanner (Scanner). Lexical analyzer generally as a function of the presence, for the parser calls.

In simple terms, it should java program code is converted into a sequence of token. In other words, it is the parser translator.

What is a parser?

In computer science and linguistics, parsing (English: Syntacticanalysis, also called Parsing) is based on some form of grammar given by the word of the sequence (such as English word sequence) composed of the input text is analyzed and determine its grammatical structure a process that.
Parser (Parser) usually as a compiler or interpreter component appears, it is the role of syntax checking, and builds a data structure composed of the input word (typically parse tree, the abstract syntax tree hierarchy, etc. data structure). A parser is generally used to separate lexical analyzer separated one by one "word" from the input character stream, and the token stream as its input. Actual development, hand written parser can, using a tool may be (semi-) automatically.
In simple terms, it is to accept the token sequence lexical analyzer and converted into AST (abstract syntax tree), and AST operate, and ultimately generate virtual machine runtime (runtime) of executable code, also class files.
Scripture says, the lexical analyzer parser translator, and the composition of the lexical analyzer and parser compiler, a runtime (runtime) translators.
We use a diagram to illustrate the programmer and the compiler, runtime relations:

 


 

 The figure, has a good explanation of the relationship between the parties, programmers write java code, the java compiler code is compiled into class files, load and execute the class file is run, and to complete related tasks by calling operating system functions.
 The above is a simple introduction to the java virtual machine architecture.
Next continue to talk about the details of the architecture.
 
 

Guess you like

Origin www.cnblogs.com/gyc567/p/11071712.html