push
[des2015.git] / dsl / xtend / src / robots / missions / TaskDSL.xtext
index 7a2de03..35ed5b0 100644 (file)
@@ -3,22 +3,24 @@ grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals
 generate taskDSL "http://www.missions.robots/TaskDSL"
 
 Robot:
-       'Name' name=ID
        'Acceleration' acc=INT
        'Speed' spd=INT
        behaviour+=Behaviour+
        mission+=Mission+;
 
-Mission: 'Mission' name=ID 'using' behaviours+=[Behaviour]+ 'and stops when' se=StoppingExpression;
+Mission: 
+       'Mission' name=ID 'using' behaviours+=[Behaviour]+ 'and stops when' se=StoppingExpression;
 
 StoppingExpression:
        '(' op=Operator s+=StoppingExpression s+=StoppingExpression+ ')' |
+       'not ' negscond=StoppingCondition |
        scond=StoppingCondition;
 
 StoppingCondition:
        'Collected at least' colors+=Color+ |
        'Touched on' touch=LeftRight |
-       'Distance' op=Comparison dist=INT 'cm' |
+       'Light on' light=LeftRight |
+       'Distance dangerous at ' dist=BackFront |
        'Color is' color=Color;
 
 Behaviour: 'Behaviour' name=ID 
@@ -26,17 +28,21 @@ Behaviour: 'Behaviour' name=ID
        'action:' actions+=Action+;
 
 Action:
-       whichMotor=LeftRight 'motor' dir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
+       whichMotor=LeftRight 'motor' moveDir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
+       'turn' turnDir=LeftRight degrees=INT ('with speed' spd=INT 'acceleration' acc=INT)? |
+       'measure' measureWhat=RockLake |
        'wait' time=Time;
 
 Time: time=INT 'ms' | {Time} 'forever';
-
+RockLake: d=RockLakeE;
+enum RockLakeE: ROCK='rock' | LAKE='lake';
 Direction: d=DirectionE;
 enum DirectionE: BACKWARDS = 'backward' | FORWARDS = 'forward';
 Operator: d=OperatorE;
-enum OperatorE: AND = 'and' | OR = 'or';
-Comparison: d=ComparisonE;
-enum ComparisonE: GE='>' | LE='<';
+enum OperatorE: AND = '&&' | OR = '||';
+BackFront: d=BackFrontE;
+enum BackFrontE: BACK = 'back' | FRONT = 'front';
 LeftRight: d=LeftRightE;
 enum LeftRightE: LEFT='left' | RIGHT='right';
 Color: d=ColorE;