baZic version 0.1 ================= (C) 2001 David Given http://www.cowlark.com dg@cowlark.com Introduction ------------ Welcome to baZic, my totally mad Basic interpreter for the Z-machine! Please note that this is unfinished. While enough exists to run a decent game of Hunt the Wumpus, there are big chunks of functionality missing; roughly 50% of the Basic language. Notably, unimplemented features are: * String operators (the hooks are there, I just need to write the code) * Subroutines (GOSUB & friends) * Procedures (SUB & friends) * Proper arrays I am unlikely ever to finish this; the Basic language is just too annoying for words. It's even more annoying to implement than to write in. (It uses the Parser from Hell.) If you wish to continue it, be my guest. What you *do* get, however, is: * Dynamic memory allocation, complete with block coalescing * A full mark/sweep garbage collector * Dynamic typing * Full tokenisation for fast(!) execution of programs * Full detokenisation when listing them again * An interactive Basic development environment (cough, cough) * State-of-the-art implementations of Hunt the Wumpus and Guess the Number built in to the very interpreter * Pseudo-arrays The memory allocator is nicely modular if you feel like ripping it out. Ditto the garbage collector. Usage ----- Run the program in the normal way. You get presented with a Basic prompt. You can now type in lines of Basic code and they will get executed. You can add lines to the current program by prefixing them with a line number. Most basic Basic keywords work. SAVE, LOAD and QUIT work as expected (for a text adventure). LIST has some extra features; LIST -1 will display the program's byte code (for those with a morbid curiosity). LIST -2 will dump the currently defined variables. If you modify the current program, all currently defined variables are lost. Variables are dynamically typed; while you can put $ and % on the end of the names if you want, they're meaningless. Arrays are funny. Rather than implement DIM, I just added a quick hack to concatenate the array index on the end of the array name. So you don't need to declare an array, and storage is only taken up for those elements that actually exist. If you have any array entries defined, LIST -2 may do strange things (the name of the array entry variables aren't strictly printable). The SCRIPT keyword allows you to load one of several predefined programs into the interpreter's memory. Use it with no arguments to list the available programs. Give it the program index for more information. SCRIPT 0 gives a brief guide to baZic (even briefer than this, although written when I had more sleep). Bugs ---- This program contains no bugs whatsoever. Excuse me, the New World Order made me say that. Credits ------- You can blame Graham Nelson, for the Inform compiler with which this is written, and Acorn, for producing the BBC Microcomputer on which I got the hack habit. License ------- This code is licensed under the MIT open source license. Copyright (c) 2001, David Given All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.