MiniBasic - how to write a script interpreter
eBook (PDF), 131 Pages
Implementation of a BASIC interpreter, with full language documentation and essay on how to write a script interpreter. Full ANSI C source included. A great resource for anyone doing a compilers and interpreters course at university, or for anyone needing to add scripting to their programs. A program BASICdraw is now available that adds a MiniBasic script interpreter to a graphics editor. The program is free, download here
Available in PDF Format
Ratings & ReviewsLog in to review this item
3 People Reviewed This Product
Nov 17, 2010I actually have to disagree with the previous post. I've been working on a derivative version of mini basic (and adding my own derivation to it) and was happy to find the chapter "How to write a BASIC interpreter" starting on page 44. While not a complete guide to writing an interpreter it does a credibly job of laying out some fundamentals of how the statement parsing works (rather, why it works as it does) and more importantly to me, how the expression parsing works. Well worth the two fifty for the download, I'd pay 10 times that for the 750 page detailed version.
Feb 9, 2010This book is more about MiniBasic than it is about how to write an interpreter. There is some description of MiniBasic, and then about a chapter's worth of how the expression parser works, and then the book is all just C code to the end. To the author: Please write a second edition with much more information in the middle part of the book.
Oct 15, 2009"Mini Basic" This little book on lulu.com caught my eye, and I purchased it via download. Malcolm clearly achieves what his strapline advertises - explaining to you "how to write a BASIC interpreter" - by writing a really good interpretor, and explaining it. Don't be put off by the sketchy cover and lack of contents page and index - the content of this book is very well written and very accessible. It sets the scene by showing a number of sample BASIC programs of increasing complexity, to get the reader into the context of BASIC and what can be expected of an interpretor. The BASIC is reminiscent of the early BASIC interpretors like Pet BASIC or 8052 BASIC, having no support for more advanced control structures that something like BBC BASIC introduced, but the fact there are only 39 keywords in the language makes it quick to learn, and makes the interpretor very tiny and fast. Tiny and fast is good if you were considering embedding this language inside a bigger... More > containing application, e.g. as a scripting language. Next, the book takes on a reference-style and explains the key syntax, followed by an alphabetical list of keywords and their function, each with small but useful examples of how to use them, followed by an error-message reference (there are only 25 errors and 39 keywords). Next, and these next two sections are the most interesting from a design point of view, the author looks at how to write an interpreter, and specifically some of the design decisions made while writing MiniBasic. He carefully navigates from some of the initial issues such as expression parsing and evaluation and control structures, through to I/O. This is then followed by focussing on some of the key design decisions and design compromises of MiniBasic, with a number of complete example MiniBasic programs to illustrate. Malcolm then completes the book with a 64 page listing of the C code that implements MiniBasic. While the code in some places has terse comments, the code is well written, well structured, and the accompanying notes in earlier text clearly describe the design and operation of the code. This is the right choice by Malcolm, because sometimes too many comments can clutter the code and make it hard to read. His programming style and layout style makes the code very clean to read and understand. MiniBasic uses a recursive-descent parsing technique, and because of this, the book would suite anyone wanting to learn about parsing techniques without having to get too sucked into the intricate detail that one expects from books like Aho, Sethi and Ullman. Having a complete working BASIC interpretor that you can compile and run and change yourself is by far the best way to absorb the techniques - by looking at and using real code. The choice of the author to put the whole interpretor in a single C file was the correct one I think, because although 64 A4 pages of code is quite long, this actually keeps the code simpler due to their being no need for module linkage and externals which would make the program much larger. An example driver module is provided that wraps the interpretor with a main(), and demonstrates the power of the fact that the BASIC program sent to the interpretor can come from anywhere - an external file, or even embedded inside the C program as a string. I spent many happy hours pouring over the source code for MiniBasic and experimenting with it, and can highly recommend this book as both an interesting and useful resource. David Whale, www.thinkingbinaries.com, February 2009.< Less
There are no reviews for previous versions of this product
- by Malcolm McLean (Standard Copyright License)
- Malcolm McLean
- November 4, 2011
- File Format
- File Size
- 385.69 KB
- Product ID
Formats for this Ebook
|Required Software||Any PDF Reader, Apple Preview|
|Supported Devices||Windows PC/PocketPC, Mac OS, Linux OS, Apple iPhone/iPod Touch... (See More)|
|# of Devices||Unlimited|
|Flowing Text / Pages||Pages|
|Learn more about ebook formats and e-readers|
Your notification has been sent
Lulu Staff has been notified of a possible violation of the terms of our Membership Agreement. Our agents will determine if the content reported is inappropriate or not based on the guidelines provided and will then take action where needed.
Thank you for notifying us. We will email you with the results and/or actions taken as a result of the investigation if you chose to receive confirmation.
We were unable to complete your request.
We were unable to complete your request.
- basic ,
- interpreter ,
- source ,
- sourcecode ,
- Computer ,
- Science ,
- Technology ,
- Languages ,
- Program ,
- Design ,
The page you are attempting to access contains content that is not intended for underage readers.
Please verify your birth date to continue.