diff --git a/src/main/java/de/maishai/Compiler.java b/src/main/java/de/maishai/Compiler.java index e9dd64d..fccf998 100644 --- a/src/main/java/de/maishai/Compiler.java +++ b/src/main/java/de/maishai/Compiler.java @@ -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"); + } } diff --git a/src/main/resources/JavaTestfiles/ClassCanBeTyped.java b/src/main/resources/JavaTestfiles/ClassCanBeTyped.java index 56ce77d..18f8632 100644 --- a/src/main/resources/JavaTestfiles/ClassCanBeTyped.java +++ b/src/main/resources/JavaTestfiles/ClassCanBeTyped.java @@ -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; }