BASIC language syntax
program : line CR (line)*
line ::= lineNumber statement
statement::= PRINT print-list
IF expression comparison-operator expression THEN statement
GOTO lineNumber
GOSUB lineNumber
RETURN
LET var = expression
INPUT (string ,) var | varString
BEEP
CLS (color)
WAIT number
COLOR color (,color)
GET CURSOR var , var
GET MOUSE var , var , var
GET GMOUSE var , var , var
GET MIRROR expression , expression , var
GET DATA expression , expression , var | varString
GETCHAR varString , expression , var
CURSOR expression , expression
MIRROR expression , expression , expression
REM
BOX expression , expression , expression , expression
PSET expression , expression
SCROLL expression , expression
print-list ::= (string | expression) (, ((string | expression) )*
expression ::= (+ | -) term ( (+ | -) term )*
term ::= factor ((*|/|%) factor)*
factor ::= var | number | operator
lineNumber ::= 1 .. 99999
number ::= digit digit*
digit ::= 0 .. 9
operator ::= tan(expression) | cos(expression) | sin(expression) | RND
comparison-operator ::= < | > | >= | <= | <> | =
var ::= A .. Z
varString ::= A$ .. Z$
color ::= BLUE | RED | CYAN | GREEN | MAGENTA | YELLOW | WHITE | BLACK | GRAY | PURPLE | ORANGE | BROWN
* = repeat
() = optional
% = modulus
Next