3302953bcfe864f8e76f4bc37ba95108b1d66bfd
[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 'Name' name=ID
7 'Acceleration' acc=INT
8 'Speed' spd=INT
9 behaviour+=Behaviour+
10 mission+=Mission+;
11
12 Mission: 'Mission' name=ID 'using' behaviours+=[Behaviour]+ 'and stops when' stoppingExpression=StoppingExpression;
13
14 StoppingExpression:
15 '(' op=Operator s+=StoppingExpression s+=StoppingExpression* ')' |
16 scond=StoppingCondition
17 ;
18
19 StoppingCondition:
20 'Collected at least' colors+=Color+ |
21 'Touched on' touch=LeftRight |
22 'Distance' op=Comparison dist=INT 'cm' |
23 'Color is' color=Color;
24
25 Behaviour: 'Behaviour' name=ID
26 'take control:' tc=StoppingExpression?
27 'action:' actions+=Action+;
28
29 Action:
30 whichMotor=LeftRight 'motor' dir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
31 'wait' time=Time;
32
33 Time: time=INT 'ms' | {Time} 'forever';
34
35 enum Direction: BACKWARDS = 'Backwards' | FORWARDS = 'Forwards';
36 enum Operator: AND = 'and' | OR = 'or';
37 enum Comparison: GE='>' | LE='<';
38 enum LeftRight: LEFT='Left' | RIGHT='Right';
39 enum Color:
40 BLACK='Black' | BLUE='Blue' | BROWN='Brown' | CYAN='Cyan' |
41 DARKGRAY='DarkGray' | GRAY='Gray' | GREEN='Green' |
42 LIGHTGRAY='LightGray' | MAGENTA='Magenta' | ORANGE='Orange' | PINK='Pink' |
43 RED='Red' | WHITE='White' | YELLOW='Yellow';