-------------------------------------
With the exception of RUN, HELP,
and QUOTE, all commands must be
prefixed with a line number.
-------------------------------------
usage
description
-------------------------------------
PRINT expr-list
print concatenated expression list
- - - - - - - - - - - - - - - - - - -
IF expr relop expr THEN stmt
conditionally execute statement
- - - - - - - - - - - - - - - - - - -
GOTO expr
jump to given line number
- - - - - - - - - - - - - - - - - - -
RETURN
return to the line following the
last GOSUB called
- - - - - - - - - - - - - - - - - - -
RUN
execute loaded code
- - - - - - - - - - - - - - - - - - -
END
end execution of program
- - - - - - - - - - - - - - - - - - -
REM comment
adds a comment
- - - - - - - - - - - - - - - - - - -
QUOTE
an inspirational quote
- - - - - - - - - - - - - - - - - - -
HELP
you just ran this
-------------------------------------
Grammar:
-------------------------------------
line ::= number stmt (: stmt)* NL
| stmt (: stmt)* NL
- - - - - - - - - - - - - - - - - - -
stmt ::= see 'usage' above
- - - - - - - - - - - - - - - - - - -
cmd ::= one of the commands above
- - - - - - - - - - - - - - - - - - -
expr-list ::= expr (, expr)*
- - - - - - - - - - - - - - - - - - -
var-list ::= var (, var)*
- - - - - - - - - - - - - - - - - - -
expr ::= term ((+|-) term)*
- - - - - - - - - - - - - - - - - - -
term ::= factor ((*|/) factor)*
- - - - - - - - - - - - - - - - - - -
factor ::= var | number
| string | (expr)
- - - - - - - - - - - - - - - - - - -
var ::= A | B | C ... | Y | Z
- - - - - - - - - - - - - - - - - - -
number ::= (+|-|eps) digit digit*
- - - - - - - - - - - - - - - - - - -
digit ::= 0 | 1 | 2 | ... | 9
- - - - - - - - - - - - - - - - - - -
relop ::= < (>eps)
| > (<|=|eps) | =
- - - - - - - - - - - - - - - - - - -
string ::= " string-char* "
- - - - - - - - - - - - - - - - - - -
string-char ::= non-quote/newline
- - - - - - - - - - - - - - - - - - -
comment ::= non-newline
- - - - - - - - - - - - - - - - - - -
eps ::= nothing
-------------------------------------
This BASIC interpreter is loosely
based on Dennis Allison's Tiny
BASIC
Most of the above grammar is taken
from page 9 of Dr. Dobb's Journal
Source code is available at here
and here
Happy hacking!
[press any key to continue]
--------------------------------------------------------------------------------
With the exception of RUN, HELP, and QUOTE, all commands must be prefixed with
a line number.
--------------------------------------------------------------------------------
command | description | usage
---------+-------------------------------------+--------------------------------
PRINT | print concatenated expression list | PRINT expr-list
IF | conditionally execute statement | IF expr relop expr THEN stmt
GOTO | jump to given line number | GOTO expr
LET | set variable to expression | LET var = expr
GOSUB | jump to given line number | GOSUB expr
RETURN | return to the line following | RETURN
| the last GOSUB called | RETURN
RUN | execute loaded code | RUN
END | end execution of program | END
REM | adds a comment | REM comment
QUOTE | an inspirational quote | QUOTE
HELP | you just ran this | HELP
--------------------------------------------------------------------------------
line ::= number stmt (: stmt)* NL | stmt (: stmt)* NL
stmt ::= see 'usage' above
cmd ::= one of the commands above
expr-list ::= expr (, expr)*
var-list ::= var (, var)*
expr ::= term ((+|-) term)*
term ::= factor ((*|/) factor)*
factor ::= var | number | string | (expr)
var ::= A | B | C ... | Y | Z
number ::= (+|-|eps) digit digit*
digit ::= 0 | 1 | 2 | 3 | ... | 8 | 9
relop ::= < (>eps) | > (<|=|eps) | =
string ::= " string-char* "
string-char ::= non-quote, non-newline character
comment ::= non-newline character
eps ::= nothing
--------------------------------------------------------------------------------
This BASIC interpreter is loosely based on Dennis Allison's Tiny BASIC
Most of the above grammar is taken from page 9 of Dr. Dobb's Journal
Source code is available at https://github.com/danieltuveson/10klob
and https://github.com/danieltuveson/dbi
Happy hacking!
[press any key to continue]
βIt is practically impossible to teach good programming to students
that have had a prior exposure to BASIC: as potential programmers
they are mentally mutilated beyond hope of regeneration.β
β Edsger Dijkstra
Run 'help' for a list of commands
[press any key to continue]
sleeping
[press any key to continue]