mirror of
https://github.com/mudabbir-ahmad/UNI-PROG3-CW2-DYOPL.git
synced 2026-10-07 20:00:20 +00:00
Add initial implementation of RobotLang interpreter and visitor pattern
This commit is contained in:
1 parent
4929d6b01e
commit
ea6d32b726
7 files changed
+114
-1
No files matched your search
@@ -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 ;
|
||||
Reference in new issue
Block a user