grammar FLJ;

// Inputsyntax für ein Featherweight Java

l2 : (l)+;

l : Class ClassName '{' (feld)*  method*  '}';


feld: ClassName Var ';';

returnExpression: 'return'  expression ';' ;
methodCall: Var '(' args? ')';


expression: Var | expression'.'methodCall  | expression'.'Var   | 'new' ClassName generics? '('expressionArgs?')'  expression?  ;
method: Var '(' expressionArgs? ')'  '{' returnExpression? '}'   ;
args:  Var  | (Var ',')+  Var ;
expressionArgs : expression | (expression ',')+ expression;

generics: '<''>';

Class: 'class';
ClassName: [A-Z]+[a-z]*;
Var: [a-z]+;



Linefeed: '\r'? '\n' -> skip; //'\r' für Windows linefeed
WS : [ \t]+ -> skip; //Überspringen aller Leerzeichen