Update Grammatik
This commit is contained in:
parent
7c91cee342
commit
1536d6c3f6
100
Grammatik.txt
100
Grammatik.txt
@ -25,14 +25,12 @@ IncDec:
|
|||||||
Expression:
|
Expression:
|
||||||
UnaryExpression
|
UnaryExpression
|
||||||
BinaryExpression
|
BinaryExpression
|
||||||
ConditionalExpression
|
|
||||||
AssignmentExpression
|
AssignmentExpression
|
||||||
MethodInvocation
|
MethodInvocation
|
||||||
CreationExpression
|
CreationExpression
|
||||||
|
|
||||||
UnaryExpression:
|
UnaryExpression:
|
||||||
Primary
|
Primary
|
||||||
UnaryOperator
|
|
||||||
UnaryExpression
|
UnaryExpression
|
||||||
UnaryOperator
|
UnaryOperator
|
||||||
+ | - | ! | ...
|
+ | - | ! | ...
|
||||||
@ -41,14 +39,11 @@ BinaryExpression:
|
|||||||
Expression BinaryOperator Expression
|
Expression BinaryOperator Expression
|
||||||
|
|
||||||
BinaryOperator:
|
BinaryOperator:
|
||||||
+ | - | * | / | & | && | | | || | ...
|
== | + | - | * | / | & | && | | | || |
|
||||||
|
|
||||||
|
|
||||||
AssignmentExpression:
|
AssignmentExpression:
|
||||||
Variable AssignmentOperator Expression
|
Variable = Expression
|
||||||
|
|
||||||
AssignmentOperator:
|
|
||||||
= | += | -= | *= | /= | ...
|
|
||||||
|
|
||||||
MethodInvocation:
|
MethodInvocation:
|
||||||
Method ( [ ActualArguments ] )
|
Method ( [ ActualArguments ] )
|
||||||
@ -73,12 +68,9 @@ Statement:
|
|||||||
|
|
||||||
SimpleStatement:
|
SimpleStatement:
|
||||||
EmptyStatement
|
EmptyStatement
|
||||||
ExpressionStatement
|
StatementExpression
|
||||||
JumpStatement
|
|
||||||
EmptyStatement ;
|
EmptyStatement ;
|
||||||
|
ReturnStatement
|
||||||
ExpressionStatement:
|
|
||||||
StatementExpression ;
|
|
||||||
|
|
||||||
StatementExpression:
|
StatementExpression:
|
||||||
AssignmentExpression
|
AssignmentExpression
|
||||||
@ -86,90 +78,53 @@ StatementExpression:
|
|||||||
MethodInvocation
|
MethodInvocation
|
||||||
CreationExpression
|
CreationExpression
|
||||||
|
|
||||||
JumpStatement:
|
|
||||||
BreakStatement
|
|
||||||
ContinueStatement
|
|
||||||
ReturnStatement
|
|
||||||
BreakStatement
|
|
||||||
break [ Label ] ;
|
|
||||||
|
|
||||||
ContinueStatement:
|
ContinueStatement:
|
||||||
continue [ Label ] ;
|
continue [ Name ] ;
|
||||||
|
|
||||||
ReturnStatement.
|
ReturnStatement.
|
||||||
return [ Expression ] ;
|
return [ Expression ] ;
|
||||||
|
|
||||||
Label:
|
|
||||||
Name
|
|
||||||
|
|
||||||
CompositeStatement:
|
CompositeStatement:
|
||||||
Block
|
Block
|
||||||
CaseStatement
|
CaseStatement
|
||||||
RepetitiveStatement
|
|
||||||
|
|
||||||
Block:
|
Block:
|
||||||
{ { VariableDeclaration | Statement } }
|
"{" { VariableDeclaration | Statement } "}"
|
||||||
VariableDeclaration [ final ] Type VariableDeclarators ;
|
|
||||||
VariableDeclarators VariableDeclarator { , VariableDeclarator }
|
VariableDeclaration:
|
||||||
VariableDeclarator Name [ = Expression ]
|
Type VariableDeclarator ;
|
||||||
|
|
||||||
|
VariableDeclarator:
|
||||||
|
Name [ = Expression ]
|
||||||
|
|
||||||
Type:
|
Type:
|
||||||
PrimitiveType
|
Name # konkrete Typen hinzufügen
|
||||||
ClassType
|
|
||||||
|
|
||||||
PrimitiveType:
|
|
||||||
Name
|
|
||||||
|
|
||||||
ClassType:
|
|
||||||
Identifier
|
Identifier
|
||||||
|
|
||||||
CaseStatement:
|
CaseStatement: # Andere CaseStatements heraussuchen. Assign, MethodCall,
|
||||||
ConditionalStatement
|
ConditionalStatement
|
||||||
SwitchStatement
|
WhileStatement
|
||||||
RepetitiveStatement WhileStatement
|
|
||||||
DoStatement
|
|
||||||
ForStatement
|
|
||||||
|
|
||||||
ConditionalStatement:
|
ConditionalStatement:
|
||||||
if ( Expression ) Statement [ else Statement ]
|
if ( Expression ) Statement [ else Statement ]
|
||||||
|
|
||||||
SwitchStatement:
|
|
||||||
switch ( Expression ) SwitchBlock
|
|
||||||
|
|
||||||
SwitchBlock:
|
|
||||||
{ { CaseGroup } }
|
|
||||||
|
|
||||||
CaseGroup:
|
|
||||||
SwitchLabel { SwitchLabel } StatementSequence
|
|
||||||
|
|
||||||
SwitchLabel:
|
|
||||||
case ConstantExpression :
|
|
||||||
default :
|
|
||||||
|
|
||||||
ConstantExpression:
|
ConstantExpression:
|
||||||
Expression
|
Expression
|
||||||
|
|
||||||
WhileStatement:
|
WhileStatement:
|
||||||
while ( Expression ) Statement
|
while ( Expression ) Statement
|
||||||
|
|
||||||
DoStatement:
|
|
||||||
do Statement while ( Expression ) ;
|
|
||||||
|
|
||||||
ForStatement:
|
|
||||||
for ( [ Initialization ] ; [ Expression ] ; [ Update ] ) Statement
|
|
||||||
|
|
||||||
Initialization:
|
Initialization:
|
||||||
StatementExpression { , StatementExpression }
|
StatementExpression { , StatementExpression }
|
||||||
VariableDeclaration
|
VariableDeclaration
|
||||||
|
|
||||||
Update:
|
|
||||||
StatementExpression { , StatementExpression }
|
|
||||||
|
|
||||||
|
|
||||||
3. Methoden
|
3. Methoden
|
||||||
|
|
||||||
MethodDeclaration:
|
MethodDeclaration:
|
||||||
MethodHeader MethodBody
|
MethodHeader Block
|
||||||
|
|
||||||
MethodHeader:
|
MethodHeader:
|
||||||
{ Modifier } ResultType MethodDeclarator
|
{ Modifier } ResultType MethodDeclarator
|
||||||
@ -181,7 +136,7 @@ ResultType:
|
|||||||
Type | void
|
Type | void
|
||||||
|
|
||||||
MethodDeclarator:
|
MethodDeclarator:
|
||||||
Identifier ( [ FormalArguments ] )
|
Identifier "(" [ FormalArguments ] ")"
|
||||||
|
|
||||||
FormalArguments:
|
FormalArguments:
|
||||||
FormalArgument { , FormalArgument }
|
FormalArgument { , FormalArgument }
|
||||||
@ -189,30 +144,23 @@ FormalArguments:
|
|||||||
FormalArgument:
|
FormalArgument:
|
||||||
Type Name
|
Type Name
|
||||||
|
|
||||||
MethodBody:
|
|
||||||
; | Block
|
|
||||||
|
|
||||||
|
|
||||||
4. Klassen
|
4. Klassen
|
||||||
|
|
||||||
|
Start:
|
||||||
|
ClassDeclaration {ClassDeclaration}
|
||||||
|
|
||||||
ClassDeclaration:
|
ClassDeclaration:
|
||||||
[ public ] class Name ClassBody
|
[ public ] class Name ClassBody
|
||||||
|
|
||||||
ClassBody:
|
ClassBody:
|
||||||
{ { { Modifier } Declaration } }
|
{ { Modifier } Declaration }
|
||||||
|
|
||||||
Declaration:
|
Declaration:
|
||||||
FieldDeclaration
|
|
||||||
MethodDeclaration
|
|
||||||
ClassDeclaration
|
|
||||||
ConstructorDeclaration
|
|
||||||
Initializer
|
|
||||||
|
|
||||||
FieldDeclaration:
|
|
||||||
VariableDeclaration
|
VariableDeclaration
|
||||||
|
MethodDeclaration
|
||||||
|
ConstructorDeclaration
|
||||||
|
|
||||||
ConstructorDeclaration:
|
ConstructorDeclaration:
|
||||||
[ public ] Name ( [ FormalArguments ] ) Block
|
[ public ] Name ( [ FormalArguments ] ) Block
|
||||||
|
|
||||||
Initializer:
|
|
||||||
[ static ] Block
|
|
Loading…
Reference in New Issue
Block a user