-
Notifications
You must be signed in to change notification settings - Fork 0
AST
Program -> epislon | ( class IDENT { ClassMember' } Program ) *
Program :: ClassMember+
ClassMember' -> public ClassMember''
ClassMember'' -> MainMethod' | Member
MainMethod' -> static void IDENT ( String [ ] IDENT ) Block
Member -> Type IDENT Member'
Member' -> ; | ( Parameters? ) Block
MainMethod :: Type Parameters Block
Member :: Type Symbol
Member' :: Type Symbol Parameters Block
Parameters -> Parameter (, Parameters)?
Parameter -> Type IDENT
Parameters :: Parameter+
Parameter :: Type Symbol
Type -> Basictype ([])*
BasicType -> int | boolean | void | IDENT
Type :: Symbol
Statement -> Block | EmptyStatement | IfStatement | ExpressionStatement | WhileStatement | ReturnStatement
Block -> { BlockStatement* }
Block :: Statement+
BlockStatement -> Block | EmptyStatement | IfStatement | ExpressionStatement | WhileStatement | ReturnStatement | LocalVariableDeclarationStatement
LocalVariableDeclarationStatement -> Type IDENT (= Expression)? ;
EmptyStatement -> ;
WhileStatement-> while ( Expression ) Statement
IfStatement -> if ( Expression ) Statement (else Statement)?
ExpressionStatement -> Expression ;
ReturnStatement -> return Expression? ;
LocalVariableDeclarationStatement :: Type Symbol (Expression)
EmptyStatement ::
WhileStatement :: Expression Statement
IfStatement Expression Statement (Statement)
ExpressionStatement :: Expression
ReturnStatement :: Expression
UnaryExpression = LogicalNotExpression | NegateExpression | PostfixExpression
LogicalNotExpression :: Expression
NegateExpression :: Expression
PostfixExpression = PrimaryExpression | ArrayAccessExpression | MethodInvovationExpression | VariableAccessExpression
ArrayAccessExpression :: Expression Expression
MethodInvovationExpression :: Expression Symbol (Expression)*
VariableAccessExpression :: Expression Symbol
Symbol ::
Symbol
PrimaryExpression = BooleanConstantExpression | IntegerConstantExpression | NullExpression | ThisExpression | NewArrayExpression | NewObjectExpression
BooleanConstantExpression ::
value
IntegerConstantExpression ::
value
NullExpression ::
ThisExpression ::
NewArrayExpression :: Type Expression
NewObjectExpression :: Symbol