Mini Java Compiler (6)

xiaoxiao2021-03-06  15

Seven, system work procedures and operations

Eight, instance program operation results

Example

Code

Class

MAIN {

Public static void main (String [] args) {

System.out.println (10);

}

}

Class g {

Class g {

Public int GET (int Num) {

Int a;

A = 2;

Return A 5;

}

}

Class H Extends g {

Class H Extends g {

INT I;

Boolean BOL;

Public int Put () {

Public int Put () {

i = 1 2;

I = 12-3;

I = 2 * 7;

Bol = True && False;

Bol = True && False;

BOL = 1 <2;

Return 10;

Return 10;

}

}

Inheritance tree

Inheritance tree

Symbol table

Symbol table

Memory allocation table

Example 2

Code

Class fact {

Public static void main (string [] a) {

System.out.println (New Fac (). Computefac (10));

}

}

Class Fac Extends Factorial {

Class Fac Extends Factorial {

FAC F;

Factorial ff;

INT I;

Public int computefac (int Num) {

Public int computefac (int Num) {

INT Numaux;

IF (Num <1)

Numaux = 1;

Else

Numaux = Num * (this.Computefac (NUM-1));

Return Numaux;

}

}

Class f extends FAC {

Class f extends FAC {

}

Class g extends factorial {

Class g extends factorial {

}

Class h {}

Class h {}

Class I extends h {}

Class I extends h {}

Class J Extends I {}

Class J Extends I {}

Class GG Extends I {}

Class GG Extends I {}

Class DD Extends I {}

Class DD Extends I {}

Inheritance tree

Symbol table

Memory allocation table

转载请注明原文地址:https://www.9cbs.com/read-46660.html

New Post(0)