X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fxtend%2Fsrc%2Frobots%2Fmissions%2FTaskDSL.xtext;h=14a834f42bf0cb8ad6cd42115d46bbbb167634fd;hb=1b13ccb59263b66abc763fb8f298b14bdebc9582;hp=7a2de03fd4b6ac55e0ee9ecd22103025ebb1cb02;hpb=55df69a5d4941d45bd3d860e6cea9b1357e09f98;p=des2015.git diff --git a/dsl/xtend/src/robots/missions/TaskDSL.xtext b/dsl/xtend/src/robots/missions/TaskDSL.xtext index 7a2de03..14a834f 100644 --- a/dsl/xtend/src/robots/missions/TaskDSL.xtext +++ b/dsl/xtend/src/robots/missions/TaskDSL.xtext @@ -3,22 +3,24 @@ grammar robots.missions.TaskDSL with org.eclipse.xtext.common.Terminals generate taskDSL "http://www.missions.robots/TaskDSL" Robot: - 'Name' name=ID '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+ ')' | + 'not ' negscond=StoppingExpression | scond=StoppingCondition; StoppingCondition: 'Collected at least' colors+=Color+ | 'Touched on' touch=LeftRight | - 'Distance' op=Comparison dist=INT 'cm' | + 'Light on' light=LeftRight | + 'Distance dangerous at ' dist=BackFront | 'Color is' color=Color; Behaviour: 'Behaviour' name=ID @@ -26,17 +28,26 @@ Behaviour: 'Behaviour' name=ID 'action:' actions+=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)? | + {Action} 'measure'| 'wait' time=Time; + +Turn: + turnDir=LeftRight 'exactly' degrees=INT 'degrees'| + 'randomly' start=INT 'to' end=INT 'degrees' +; 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; -enum OperatorE: AND = 'and' | OR = 'or'; -Comparison: d=ComparisonE; -enum ComparisonE: GE='>' | LE='<'; +enum OperatorE: AND = '&&' | OR = '||'; +BackFront: d=BackFrontE; +enum BackFrontE: BACK = 'back' | FRONT = 'front'; LeftRight: d=LeftRightE; enum LeftRightE: LEFT='left' | RIGHT='right'; Color: d=ColorE;