X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fxtend%2Fsrc%2Frobots%2Fmissions%2FTaskDSL.xtext;h=35ed5b0b6e799c111ea3853d59ce2889785c97b8;hb=08b6c73b2092b16b5dc1c0f2884d2e9c49c445af;hp=456ac4c099263563a1a16188fb56500857cb04e3;hpb=d9e24efc7491c75496d20fbfd1e48954605ea301;p=des2015.git diff --git a/dsl/xtend/src/robots/missions/TaskDSL.xtext b/dsl/xtend/src/robots/missions/TaskDSL.xtext index 456ac4c..35ed5b0 100644 --- a/dsl/xtend/src/robots/missions/TaskDSL.xtext +++ b/dsl/xtend/src/robots/missions/TaskDSL.xtext @@ -3,40 +3,46 @@ 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=StoppingCondition | 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 'take control:' tc=StoppingExpression? - 'action:' actions+=Action+ (clcColor='collect color')?; + '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' turnDir=LeftRight degrees=INT ('with speed' spd=INT 'acceleration' acc=INT)? | + 'measure' measureWhat=RockLake | 'wait' time=Time; 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;