Add initial implementation of RobotLang interpreter and visitor pattern

This commit is contained in:
bobbert committed 2026-04-27 15:29:10 +01:00
1 parent 4929d6b01e
commit ea6d32b726
7 files changed
+114 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
grammar RobotLang;
prog: stat+ ;
stat: moveStat
| grabStat
| releaseStat
| waitStat
| logStat
| repeatStat
;
moveStat: 'MOVE' NUMBER ';' ;
grabStat: 'GRAB' ';' ;
releaseStat: 'RELEASE' ';' ;
waitStat: 'WAIT' NUMBER ';' ;
logStat: 'LOG' STRING ';' ;
repeatStat: 'REPEAT' NUMBER '{' stat+ '}' ;
NUMBER: [0-9]+ ;
STRING: '"' .*? '"' ;
WS: [ \t\r\n]+ -> skip ;