RoboWaiter/ptml/ptml.g4

21 lines
683 B
Plaintext
Raw Normal View History

grammar ptml;
2023-10-08 15:44:59 +08:00
root : tree+ EOF;
tree : internal_node ':' (action_sign|tree)+ ;
internal_node : 'sequence' | 'selector' | 'parallel' Integer | 'decorator' ;
2023-10-08 15:44:59 +08:00
action_sign : ('task'|'cond') Names '(' action_parm? ')';
action_parm : (var_decls|Integer|Float|boolean) (',' (var_decls|Integer|Float|boolean))* ;
var_decls : var_type Names ;
var_type : 'int' | 'float' | 'bool' | 'string' ;
boolean : 'True' | 'False' ;
Names : [a-zA-Z_][a-zA-Z_0-9]* ;
Integer : '-'?[1-9][0-9]* | '0' ;
Float : [0-9]+'.'[0-9]* | '.'[0-9]+ ;
// comments
LINE_COMMENT : '//' .*? '\r'?'\n' -> skip ;
// useless
WS : [ \t\u000C\r\n]+ -> skip ;