Compare commits

...

2 Commits

Author SHA1 Message Date
David Mueller
34b33d7353 Merge remote-tracking branch 'origin/master' 2024-05-08 10:33:39 +02:00
David Mueller
404aa3236f no pivate and potected anymoe 2024-05-08 10:32:03 +02:00

View File

@ -3,12 +3,12 @@ grammar Decaf;
program: classdecl+;
//class identifier{...}
classdecl: (AccessModifierPrivate|AccessModifierPublic|AccessModifierProtected)? 'class' Identifier OpenCurlyBracket (constuctorDecl|fieldDecl|methodDecl)* ClosedCurlyBracket;
constuctorDecl: (AccessModifierPrivate|AccessModifierPublic|AccessModifierProtected)? Identifier OpenRoundBracket parameterList? ClosedRoundBracket block; //Maybe not needed
classdecl: AccessModifierPublic? 'class' Identifier OpenCurlyBracket (constuctorDecl|fieldDecl|methodDecl)* ClosedCurlyBracket;
constuctorDecl: AccessModifierPublic? Identifier OpenRoundBracket parameterList? ClosedRoundBracket block; //Maybe not needed
//Method and FieldVar
methodDecl: MainMethodDecl block | (AccessModifierPrivate|AccessModifierPublic|AccessModifierProtected)? (type | Void) Identifier OpenRoundBracket parameterList? ClosedRoundBracket block;
fieldDecl: (AccessModifierPrivate|AccessModifierPublic|AccessModifierProtected)? type Identifier Semicolon;
methodDecl: MainMethodDecl block | AccessModifierPublic? (type | Void) Identifier OpenRoundBracket parameterList? ClosedRoundBracket block;
fieldDecl: AccessModifierPublic? type Identifier Semicolon;
//Parameters
parameterList: parameter(Comma parameter)*;
@ -57,8 +57,6 @@ value: IntValue | BooleanValue | CharValue | NullValue;
//Access modifier
AccessModifierPublic : 'public' ;
AccessModifierPrivate : 'private';
AccessModifierProtected : 'protected';
MainMethodDecl : 'public static void main(String[] args)';
//Types