Last active
February 2, 2017 02:22
-
-
Save adamnew123456/b9ffcfe6b46ba3cd443e3be8679fbe48 to your computer and use it in GitHub Desktop.
Sample MiniJava File For Parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bean {} | |
class Main { | |
// Visibility Access Type id | |
public static int x; | |
public int[] x; | |
private static boolean x; | |
private Bean x; | |
private Bean[] xIs_A_Good_Variable_Name18283_28AXY; | |
// Visibility Access (Type | void) id '(' ParameterList? ')' '{' Statement* '}' | |
public static int f(boolean a, int[] b, Bean c, Bean[] d) { } | |
public int[] f(boolean a, int[] b, Bean c, Bean[] d) { } | |
private static boolean f(boolean a, int[] b, Bean c, Bean[] d) { } | |
private Bean f(boolean a) { } | |
private Bean[] f() { } | |
public static void f(boolean a, int[] b, Bean c, Bean[] d) { } | |
public void f(boolean a, int[] b, Bean c, Bean[] d) { } | |
private static void f(boolean a) { } | |
private void f() { } | |
/* | |
* { Statement* } | |
* | Type id '=' Expression ';' | |
* | Reference '=' Expression ';' | |
* | Reference '(' ArgumentList? ')' ';' | |
* | return Expression? ';' | |
* | if '(' Expression ')' Statement ('else' Statement)? | |
* | while '(' Expression ')' Statement | |
*/ | |
public void testStatements() { | |
boolean x = true; | |
x = false; | |
Bean b = new Bean(); | |
this.b.foo[27].bar.baz[x] = -(x >= true || !(y && z)); | |
if (b.foo[27].bar.baz[x](1, false, new int[68], b[9])) { | |
while (((((x))))) { | |
} | |
} | |
if (false) { | |
return; | |
} else { | |
return 57 * 98 != 42 < true + (new Bean[false != function[42](1,2,3)]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment