1 grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals
3 generate taskDSL "http://www.missions.robots/TaskDSL"
12 'Mission' name=ID 'using' behaviours+=[Behaviour]+ 'and stops when' se=StoppingExpression;
15 '(' op=Operator s+=StoppingExpression s+=StoppingExpression+ ')' |
16 'not ' negscond=StoppingExpression |
17 scond=StoppingCondition;
20 'flag set' varName=ID |
21 'Touched on' touch=LeftRight |
22 'Light on' light=LeftRight |
23 'Distance dangerous at ' dist=BackFront |
24 'Color is' color=Color |
25 {StoppingCondition} 'Never';
27 Behaviour: 'Behaviour' name=ID
28 'take control:' tc=StoppingExpression?
29 'action:' actions+=Action+
33 whichMotor=LeftRight 'motor' moveDir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
34 'turn' turnType=Turn ('with speed' spd=INT 'acceleration' acc=INT)? |
35 'measure' rl=RockLake|
37 'set flag' varName=ID;
40 turnDir=LeftRight 'exactly' degrees=INT 'degrees'|
41 'randomly' start=INT 'to' end=INT 'degrees'
44 Time: time=INT 'ms' | {Time} 'forever';
46 RockLake: d=RockLakeE;
47 enum RockLakeE: ROCK='Rock' | LAKE='Lake';
48 Direction: d=DirectionE;
49 enum DirectionE: BACKWARDS = 'backward' | FORWARDS = 'forward';
50 Operator: d=OperatorE;
51 enum OperatorE: AND = '&&' | OR = '||';
52 BackFront: d=BackFrontE;
53 enum BackFrontE: BACK = 'back' | FRONT = 'front';
54 LeftRight: d=LeftRightE;
55 enum LeftRightE: LEFT='left' | RIGHT='right';
58 RED='Red' | GREEN='Green' | BLUE='Blue' | YELLOW='Yellow' |
59 MAGENTA='Magenta'| ORANGE='Orange'| WHITE='White' | BLACK='Black' |
60 PINK='Pink' | GRAY='Gray' | LIGHTGRAY='LightGray' |
61 DARKGRAY='DarkGray' | CYAN='Cyan' | BROWN='Brown';