optimopium / TestForMiniJavaCompiler

TestForMiniJavaCompiler is repository devoted to writing test for minijava grammar compiler.(software testing course)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MiniJava

Mini-Java is a subset of Java. MiniJava compiler implement a compiler for the Mini-java programming language.

Rules

Goal --> Source EOF
Source --> ClassDeclarations MainClass
MainClass --> class Identifier { public static void main() { VarDeclarations Statements}}
ClassDeclarations --> ClassDeclaration ClassDeclarations | eps
ClassDeclaration --> class Identifier Extension { FieldDeclarations MethodDeclarations }
Extension --> extends Identifier | eps
FieldDeclarations --> FieldDeclaration FieldDeclarations | eps
FieldDeclaration --> static Type Identifier ;
VarDeclarations --> VarDeclaration VarDeclarations | eps
VarDeclaration --> Type Identifier ;
MethodDeclarations --> MethodDeclaration MethodDeclarations | eps
MethodDeclaration --> public static Type Identifier ( Parameters ) { VarDeclarations Statements return GenExpression ; }
Parameters --> Type Identifier Parameter | eps
Parameter --> , Type Identifier Parameter | eps
Type --> boolean | int
Statements --> Statements Statement | eps
Statement --> { Statements } | if ( GenExpression ) Statement else Statement | while ( GenExpression ) Statement | System.out.println ( GenExpression ) ; | Identifier = GenExpression ;
GenExpression --> Expression | RelExpression
Expression --> Expression + Term | Expression - Term | Term
Term --> Term * Factor | Factor
Factor --> ( Expression ) | Identifier | Identifier . Identifier | Identifier . Identifier ( Arguments ) | true | false | Integer
RelExpression --> RelExpression && RelTerm | RelTerm
RelTerm --> Expression == Expression | Expression < Expression
Arguments --> GenExpression Argument | eps
Argument --> , GenExpression Argument | eps
Identifier --> <IDENTIFIER_LITERAL>
Integer --> <INTEGER_LITERAL>

About

TestForMiniJavaCompiler is repository devoted to writing test for minijava grammar compiler.(software testing course)

License:MIT License


Languages

Language:Jupyter Notebook 90.1%Language:HTML 8.3%Language:Java 0.8%Language:TeX 0.6%Language:CSS 0.1%