"Java Virtual machine explaining" Reading notes-chapter II compilation principle of byte code

Source: Internet
Author: User

The JVM can also execute code in other languages, such as Ruby,js, as long as they are compiled into a specification-compliant byte code

Related information can be Baidu JRuby, etc.

And Java itself compiles the bytecode of the tool that we all know Javac.exe

However, our compilation in Eclipse is not implemented by reading the JDK execution Javac, but using the ECJ compiler implemented by Eclipse, Javac with full-volume compilation, ECJ using incremental compilation, and Tomcat compiling JSP pages using ECJ

Compilation is divided into 4 parts

  1. Lexical analysis

    Converts content such as keywords and identifiers in the source code into a token sequence that conforms to the Java syntax specification, and then matches the checksum by the specified order rules (converting and verifying that the keywords and identifiers are correct)

2. Grammatical analysis

Integrate the token sequence into a syntax tree, such as a catch after a try (generate a syntax tree and verify that the syntax is correct)

3. Semantic Analysis

Extending the syntax tree

4. Generate bytecode (follow-up details)


How to download the deployment Javac compiler source code

Download.java.net/openjdk/jdk8

Create a new Java project and import or copy files from the/langtools/src/share/classes folder in the downloaded compressed file into the code area. Note Set your Eclipse compiler version to 1.5 or more, while the JRE uses as much of the Eclipse's own

"Java Virtual machine explaining" Reading notes-chapter II compilation principle of byte code

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.