manual: CI check with nitunit
[nit.git] / contrib / simplan / simplan.sablecc
1 Grammar simplan;
2
3 Lexer
4
5 letter = 'a'..'z'|'a'..'Z';
6 digit = '0'..'9';
7 name = letter (letter|digit)*;
8 nb = digit* '.' digit+ | digit+;
9
10 eol = #10 | #13 | #10 #13;
11 comment = '#' (Any-eol)* eol?;
12
13 blank = #9 | #10 | #13 | ' ' | comment;
14
15 Parser
16
17 Ignored blank;
18
19 file = problem | plan ;
20
21 problem = locations roads robots parcels goal;
22 locations = 'Locations' '{' [list:]location* '}';
23 location = name [x:]nb [y:]nb ';';
24 roads = 'Roads' '{' [list:]road* '}';
25 road = [orig:]name [dest:]name ';' ;
26 robots = 'Robots' '{' [list:]robot* '}';
27 robot = name [emplacement:]name ';';
28 parcels = 'Parcels' '{' [list:]parcel* '}';
29 parcel = name [emplacement:]name ';';
30 goal = 'Goals' '{' [list:]parcel* '}';
31
32 plan = 'SimplePlan' '{' [actions:]action* '}';
33 action =
34         {load:} 'Load' '(' [robot:]name ',' [parcel:]name ')' ';' |
35         {unload:} 'Unload' '(' [robot:]name ',' [parcel:]name ')' ';' |
36         {drive:} 'Drive' '(' [robot:]name ',' [orig:]name ',' [dest:]name ')' ';' ;