no pivate and potected anymoe

This commit is contained in:
David Mueller 2024-05-08 10:32:03 +02:00
parent d2ed7c9fde
commit 404aa3236f

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