CONTENTS: |
Cheesecake BASIC is an implementation of a simple BASIC interpreter.
It was originaly written in QuickBasic.
Following is a description of the files included in the Cheesecake BASIC distribution:
ccbasic.bi | Global include file |
ccbasic.bas | Cheesecake BASIC main module, symbol table, memory and other functions |
interp.bas | Interpreter and Lexer |
parser.bas | Parser functions |
parser1.bas | More parser functions |
ccbasic.mak | MAK file for QuickBasic to compile the program |
(Note: The Powerbasic version of Cheesecake BASIC has only one source file: ccbasic.bas) |
|
ccbasic.exe | Cheesecake BASIC executable |
readme.txt | Documentation |
samples\hangman.bas | A sample file implementing a "Hangman" game |
samples\words.txt | Input file used by hangman.bas |
Cheesecake BASIC supports the following data types:
2-byte integers (%)
4-byte reals (!)
strings ($)
Symbols without a suffix type character (%, !, $) are integer whatever their name.
The Cheesecake BASIC interpreter has the following
commands:
BYE | Exits the interpreter |
DUMP [SYM|MEM|SYS] [TO "FileName"] | Dumps interpreter structures |
LIST [Line [- Line] ] | Lists program |
LOAD "FileName" | Loads a program |
NEW | Resets the interpreter |
RENUM [Increment] | Renumbers program lines |
RUN | Runs program |
SAVE "FileName" | Saves program |
TRACE {ON | OFF} | Turns program trace on/off |
BRK Line | Sets breakpoint at specific line |
CBRK [Line] | Clears breakpoint. If no line is specified, clears all breakpoints in program |
CONT | Continues execution after a STOP in the program or a breakpoint hit |
Line [Basic statements] | Adds/Removes/Replaces a program line |
Cheesecake BASIC implements the following BASIC instructions: BEEP CHDIR "directory" CLOSE #filenumber CLS COLOR fg [, bg] DATA constant [,constant]* DEF functionname(args) = expression DIM var [, var]* END ERROR errornumber FIELD #filenumber, integer as fieldname [, integer as fieldname]* FOR id = integer TO integer [STEP integer] GET #filenumber GOSUB linenumber GOTO linenumber IF exp THEN statements [ ELSE statements ] INPUT [#filenumber,] [prompt{,|;}] var [, var]* KEY (keynumber) { ON | OFF } [LET | LSET | RSET] var = exp LINE INPUT [#exp,] [prompt {,|;}] var LOCATE x, y NEXT [id] ON ERROR GOTO linenumber ON exp GOSUB linenumber [, linenumber]* ON exp GOTO linenumber [, linenumber]* ON KEY (keynumber) GOSUB linenumber ON TIMER (seconds) GOSUB linenumber OPEN filename [FOR {INPUT|OUTPUT|APPEND|RANDOM}] as
#filenumber [LEN=len] PRINT [#filenumber,] print-list PUT #filenumber RANDOMIZE [exp] READ var [,var]* REM (or apostrophe) RESTORE [linenumber] RESUME [ NEXT | linenumber] RETURN [linenumber] SEEK #filenumber, recordnumber SHELL command SLEEP seconds TIMER { ON | OFF } WEND WHILE exp STOP Cheesecake BASIC implements the following functions: ABS ASC ATN CHR$ CINT COS CURSORX CURSORY CVI CVS DATE$ EOF ERL ERR ERT$ (returns error text) EXP FIX INKEY$ INSTR INT LCASE$ LEFT$ LEN LOC LOF LOG LTRIM$ MID$ MKI$ MKS$ RIGHT$ RND RTRIM$ SEEK SIN SQR STR$ TIME$ TIMER UCASE$ VAL Cheesecake BASIC has a (big) number of limitations.
The file ccbasic.bi contains constants for all (or most) of
the limits in Cheesecake BASIC. Among the limitations are: Number of dimensions in an array (3). Number of integer, real and string variables (or array elements). In the
QuickBasic implementation of Cheesecake BASIC this number is 500 of each. Number of program lines. In the QuickBasic implementation of Cheesecake
BASIC this is limited to 500. Number of parameters in user-defined functions. In the QuickBasic
implementation of Cheesecake BASIC this number is 3. Maximum loop nesting: 5 levels Maximum subroutine levels: 10 Etc.
Comments, bug reports etc. can be sent to the author at
noktosoft@megafolio.com
The latest version of the interpreter can be downloaded from
noktosoft.megafolio.com
This is free software subject to the GNU General Public License
as described in the source code
Line numbers are required in Cheesecake BASIC.
Multiple statements are allowed in one line, separated by colons e.g.
10 PRINT "Hello" : GOSUB 300 : END
Note that FN is not required e.g.:
10 DEF PlusOne(x) = x + 1
20 PRINT PlusOne(5)
Note that arrays are limited to 3 dimensions