update with colors etc, we now need to test it on physical robots
[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' se=StoppingExpression;
13
14 StoppingExpression:
15 '(' op=Operator s+=StoppingExpression s+=StoppingExpression+ ')' |
16 scond=StoppingCondition;
17
18 StoppingCondition:
19 'Collected at least' colors+=Color+ |
20 'Touched on' touch=LeftRight |
21 'Distance' op=Comparison dist=INT 'cm' |
22 'Color is' color=Color;
23
24 Behaviour: 'Behaviour' name=ID
25 'take control:' tc=StoppingExpression?
26 'action:' actions+=Action+;
27
28 Action:
29 whichMotor=LeftRight 'motor' dir=Direction ('with speed' spd=INT 'acceleration' acc=INT)? |
30 'wait' time=Time;
31
32 Time: time=INT 'ms' | {Time} 'forever';
33
34 Direction: d=DirectionE;
35 enum DirectionE: BACKWARDS = 'backward' | FORWARDS = 'forward';
36 Operator: d=OperatorE;
37 enum OperatorE: AND = 'and' | OR = 'or';
38 Comparison: d=ComparisonE;
39 enum ComparisonE: GE='>' | LE='<';
40 LeftRight: d=LeftRightE;
41 enum LeftRightE: LEFT='left' | RIGHT='right';
42 Color: d=ColorE;
43 enum ColorE:
44 RED='Red' | GREEN='Green' | BLUE='Blue' | YELLOW='Yellow' |
45 MAGENTA='Magenta'| ORANGE='Orange'| WHITE='White' | BLACK='Black' |
46 PINK='Pink' | GRAY='Gray' | LIGHTGRAY='LightGray' |
47 DARKGRAY='DarkGray' | CYAN='Cyan' | BROWN='Brown';