Computer Science, asked by krishjaiswal2323, 7 months ago

3.The correct sequence of compilation and interpretation process in Java is_________​

Answers

Answered by rudransh34
1

Answer:

Java, being a platform independent programming language, doesn’t work on one-step-compilation. Instead, it involves a two-step execution, first through an OS independent compiler; and second, in a virtual machine (JVM) which is custom-built for every operating system. The two principle stages are explained below:

Compilation

First, the source ‘.java’ file is passed through the compiler, which then encodes the source code into a machine independent encoding, known as Bytecode. The content of each class contained in the source file is stored in a separate ‘.class’ file. While converting the source code into the bytecode, the compiler follows the following steps:

Parse: Reads a set of *.java source files and maps the resulting token sequence into AST (Abstract Syntax Tree)-Nodes.

Enter: Enters symbols for the definitions into the symbol table.

Process annotations: If Requested, processes annotations found in the specified compilation units.

Attribute: Attributes the Syntax trees. This step includes name resolution, type checking and constant folding.

Flow: Performs dataflow analysis on the trees from the previous step. This includes checks for assignments and reachability.

Desugar: Rewrites the AST and translates away some syntactic sugar.

Generate: Generates ‘.Class’

Similar questions