mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 16:48:03 +00:00
added what can be typed
This commit is contained in:
parent
5a5b467407
commit
a38ea3ad02
@ -14,7 +14,7 @@ import java.io.IOException;
|
||||
* Decaf language Compiler
|
||||
*/
|
||||
public class Compiler {
|
||||
|
||||
/*
|
||||
public static void main(String[] args) {
|
||||
generateAST("""
|
||||
public class ClassWithConstructorWithParameters {
|
||||
@ -33,7 +33,7 @@ public class Compiler {
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
} */
|
||||
|
||||
public static Class generateAST(String fromSource) {
|
||||
CharStream input = CharStreams.fromString(fromSource);
|
||||
@ -83,7 +83,7 @@ public class Compiler {
|
||||
CodeGenUtils.writeClassfile(bytes, classname);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// generateByteCodeFileFromFile("src/main/resources/JavaTestfiles/ClassWithConstructor.java", "ClassWithConstructor");
|
||||
// }
|
||||
public static void main(String[] args) {
|
||||
generateByteCodeFileFromFile("src/main/resources/JavaTestfiles/ClassCanBeTyped.java", "ClassCanBeTyped");
|
||||
}
|
||||
}
|
||||
|
@ -6,46 +6,34 @@ public class ClassCanBeTyped {
|
||||
public ClassCanBeTyped() {
|
||||
this.x = 10;
|
||||
int i;
|
||||
for (i = 0; i < (x+1); i = i + 1) {
|
||||
for (i = 0; i < (x + 1); i = i + 1) {
|
||||
int j;
|
||||
for (j = 0; j < this.x; j += 1) {
|
||||
this.x = this.x * this.x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
do{
|
||||
do {
|
||||
this.y = this.y + 1;
|
||||
}while (this.y < 10)
|
||||
} while (this.y < 10)
|
||||
|
||||
if(this.x > 10) {
|
||||
this.x = 10;
|
||||
} else {
|
||||
this.x = 20;
|
||||
}
|
||||
int k;
|
||||
k = 0;
|
||||
for ( k = 0; k < 10; k = k+1) {
|
||||
if(k == 5) {
|
||||
for (k = 0; k < 10; k = k + 1) {
|
||||
if (k == 5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ClassCanBeTyped(int x, int y, char z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
}
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
public char getZ() {
|
||||
return this.z;
|
||||
public int getX(char z) {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user