repositories
/
des2015.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
standard missions done
[des2015.git]
/
dsl
/
xtend
/
src
/
robots
/
missions
/
TaskDSL.xtext
diff --git
a/dsl/xtend/src/robots/missions/TaskDSL.xtext
b/dsl/xtend/src/robots/missions/TaskDSL.xtext
index
456ac4c
..
641e3c3
100644
(file)
--- a/
dsl/xtend/src/robots/missions/TaskDSL.xtext
+++ b/
dsl/xtend/src/robots/missions/TaskDSL.xtext
@@
-3,40
+3,52
@@
grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals
generate taskDSL "http://www.missions.robots/TaskDSL"
Robot:
generate taskDSL "http://www.missions.robots/TaskDSL"
Robot:
- 'Name' name=ID
'Acceleration' acc=INT
'Speed' spd=INT
behaviour+=Behaviour+
mission+=Mission+;
'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+ ')' |
StoppingExpression:
'(' op=Operator s+=StoppingExpression s+=StoppingExpression+ ')' |
+ 'not ' negscond=StoppingExpression |
scond=StoppingCondition;
StoppingCondition:
'Collected at least' colors+=Color+ |
'Touched on' touch=LeftRight |
scond=StoppingCondition;
StoppingCondition:
'Collected at least' colors+=Color+ |
'Touched on' touch=LeftRight |
- 'Distance' op=Comparison dist=INT 'cm' |
- 'Color is' color=Color;
+ 'Light on' light=LeftRight |
+ 'Distance dangerous at ' dist=BackFront |
+ 'Color is' color=Color |
+ {StoppingCondition} 'Never';
Behaviour: 'Behaviour' name=ID
'take control:' tc=StoppingExpression?
Behaviour: 'Behaviour' name=ID
'take control:' tc=StoppingExpression?
- 'action:' actions+=Action+
(clcColor='collect color')?
;
+ 'action:' actions+=Action+;
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' turnType=Turn ('with speed' spd=INT 'acceleration' acc=INT)? |
+ 'measure' rl=RockLake|
'wait' time=Time;
'wait' time=Time;
+
+Turn:
+ turnDir=LeftRight 'exactly' degrees=INT 'degrees'|
+ 'randomly' start=INT 'to' end=INT 'degrees'
+;
Time: time=INT 'ms' | {Time} 'forever';
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;
Direction: d=DirectionE;
enum DirectionE: BACKWARDS = 'backward' | FORWARDS = 'forward';
Operator: d=OperatorE;
-enum OperatorE: AND = '
and' | OR = 'or
';
-
Comparison: d=Comparison
E;
-enum
ComparisonE: GE='>' | LE='<
';
+enum OperatorE: AND = '
&&' | OR = '||
';
+
BackFront: d=BackFront
E;
+enum
BackFrontE: BACK = 'back' | FRONT = 'front
';
LeftRight: d=LeftRightE;
enum LeftRightE: LEFT='left' | RIGHT='right';
Color: d=ColorE;
LeftRight: d=LeftRightE;
enum LeftRightE: LEFT='left' | RIGHT='right';
Color: d=ColorE;