Skip to content
Valentin Zickner edited this page Nov 16, 2014 · 19 revisions

Abstract Syntax

Program :: ClassDeclaration+

ClassDeclaration :: ClassMember+

ClassMember = FieldDeclaration | MethodDeclaration

FieldDeclaration :: Type Symbol

MethodDeclaration :: Type Symbol Parameter+ Block

ParameterDefinition :: Type Symbol

Type = ArrayType | BasicType | ClassType

ArrayType :: Type

BasicType :: value

ClassType :: Symbol

Block = Statement+

Statement = IfStatement | LocalVariableDeclaration | WhileStatement | Expression

IfStatement :: Expression Statement Statement

WhileStatement :: Expression Statement

BinaryExpressions

Expression :: AssignmentExpression | LogicalOrExpression | LogicalAndExpression | EqualityExpression | RelationalExpression | AdditiveExpression | MultiplicativeExpression | UnaryExpression

AssignmentExpression :: Expression Expression

LogicalOrExpression :: Expression Expression

usw.

UnaryExpressions and following

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

Clone this wiki locally