Compare commits
2 Commits
61a9025274
...
34b33d7353
Author | SHA1 | Date | |
---|---|---|---|
|
34b33d7353 | ||
|
404aa3236f |
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user