65351f933c68e1cf45a27bfe1aecbd9b7e49814f
[des2015.git] / dsl / xtend / src / robots / missions / TaskDSL.xtext
1 grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals
2
3 generate taskDSL "http://www.missions.robots/TaskDSL"
4
5 Robot:
6 'Acceleration' acc=INT
7 'Speed' spd=INT
8 behaviour+=Behaviour+
9 mission+=Mission+;
10
11 Mission:
12 'Mission' name=ID 'using' behaviours+=[Behaviour]+ 'and stops when' se=StoppingExpression;
13
14 StoppingExpression:
15 '(' op=Operator s+=StoppingExpression s+=StoppingExpression+ ')' |
16 'not ' negscond=StoppingCondition |
17 scond=StoppingCondition;
18
19 StoppingCondition:
20 'Collected at least' colors+=Color+ |
21 'Touched on' touch=LeftRight |
22 'Light on' light=LeftRight |
23 'No object in sight on ' dist=BackFront |
24 'Color is' color=Color;
25
26 Behaviour: 'Behaviour' name=ID
27 'take control:' tc=StoppingExpression?
28 'action:' actions+=Action+;
29
30 Action:
31 whichMotor=LeftRight 'motor' moveDir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
32 'turn' turnDir=LeftRight degrees=INT ('with speed' spd=INT 'acceleration' acc=INT)? |
33 'measure' measureWhat=RockLake |
34 'wait' time=Time;
35
36 Time: time=INT 'ms' | {Time} 'forever';
37
38 RockLake: d=RockLakeE;
39 enum RockLakeE: ROCK='rock' | LAKE='lake';
40 Direction: d=DirectionE;
41 enum DirectionE: BACKWARDS = 'backward' | FORWARDS = 'forward';
42 Operator: d=OperatorE;
43 enum OperatorE: AND = 'and' | OR = 'or';
44 BackFront: d=BackFrontE;
45 enum BackFrontE: BACK = 'back' | FRONT = 'front';
46 Comparison: d=ComparisonE;
47 enum ComparisonE: GE='>' | LE='<';
48 LeftRight: d=LeftRightE;
49 enum LeftRightE: LEFT='left' | RIGHT='right';
50 Color: d=ColorE;
51 enum ColorE:
52 RED='Red' | GREEN='Green' | BLUE='Blue' | YELLOW='Yellow' |
53 MAGENTA='Magenta'| ORANGE='Orange'| WHITE='White' | BLACK='Black' |
54 PINK='Pink' | GRAY='Gray' | LIGHTGRAY='LightGray' |
55 DARKGRAY='DarkGray' | CYAN='Cyan' | BROWN='Brown';