-
Notifications
You must be signed in to change notification settings - Fork 0
AST
Program -> epislon | ( class IDENT { ClassMember' } Program ) *
Program :: ClassDeclaration+
ClassMember' -> public ClassMember''
ClassMember'' -> MainMethod' | Member
MainMethod' -> static void IDENT ( String [ ] IDENT ) Block
Member -> Type IDENT Member'
Member' -> ; | ( Parameters? ) Block
Parameters -> Parameter (, Parameters)?
Parameter -> Type IDENT
Type -> Basictype ([])*
BasicType -> int | boolean | void | IDENT
Statement -> Block | EmptyStatement | IfStatement | ExpressionStatement | WhileStatement | ReturnStatement
Block -> { BlockStatement* }
-
BlockStatement -> Block | EmptyStatement | IfStatement | ExpressionStatement | WhileStatement | ReturnStatement | LocalVariableDeclarationStatement
<-- SLL(3) LocalVariableDeclarationStatement -> Type IDENT (= Expression)? ;
EmptyStatement -> ;
WhileStatement-> while ( Expression ) Statement
IfStatement -> if ( Expression ) Statement (else Statement)?
ExpressionStatement -> Expression ;
ReturnStatement -> return 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