[client] exeute command
This commit is contained in:
49
client/bf.g4
Normal file
49
client/bf.g4
Normal file
@@ -0,0 +1,49 @@
|
||||
grammar bf;
|
||||
|
||||
program
|
||||
: statements EOF;
|
||||
|
||||
statements
|
||||
: eligibleStmt*;
|
||||
|
||||
eligibleStmt
|
||||
: stmt
|
||||
| numberedStmt
|
||||
;
|
||||
|
||||
numberedStmt
|
||||
: stmt NUMBER
|
||||
;
|
||||
|
||||
stmt
|
||||
: basicStmt
|
||||
| loopStmt
|
||||
;
|
||||
|
||||
|
||||
loopStmt
|
||||
: LOOPSTART statements LOOPEND
|
||||
;
|
||||
|
||||
basicStmt
|
||||
: INC # ptrIncr
|
||||
| DEC # ptrDecr
|
||||
| LEFT # ptrLeft
|
||||
| RIGHT # ptrRight
|
||||
| INPUT # inputStmt
|
||||
| OUTPUT # outputStmt
|
||||
;
|
||||
|
||||
|
||||
LOOPSTART: '[';
|
||||
LOOPEND:']';
|
||||
NUMBER: [0-9]+;
|
||||
INPUT: ',';
|
||||
OUTPUT: '.';
|
||||
DEC: '-';
|
||||
INC: '+';
|
||||
LEFT: '<';
|
||||
RIGHT: '>';
|
||||
EVERYTHING_ELSE: . ->channel(HIDDEN);
|
||||
WS: [ \r\n] -> skip;
|
||||
|
Reference in New Issue
Block a user