Linked by Thom Holwerda on Fri 25th Aug 2006 09:03 UTC, submitted by anonymous
General Development Adam Dunkels, well-known author of the Contiki operating system and the uIP embedded TCP/IP stack, has written a really small BASIC interpreter called uBASIC in about 700 lines of C code. It is intended to be a very small scripting language for systems where memory really is at a premium such as deeply embedded systems which may have as little as a few hundreds of bytes of RAM. It provides an interesting look into how to write a very lightweight script interpreter.
Thread beginning with comment 156007
To read all comments associated with this story, please click here.
One more thought...
by DoctorPepper on Fri 25th Aug 2006 21:47 UTC
DoctorPepper
Member since:
2005-07-12

This takes me back to the early 1980's, and my introduction to micro-computers (VIC-20, mid-1982). All of the major brands of computer had a built-in BASIC interpreter, and most of them were quite frugal with resource use.

Take the TRS-80 Model 100 (released around 1983). This small "notebook" computer had about 32 KB of programming in ROM, which held all of the built-in applications, including a text editor, address book, scheduler, communications program AND a BASIC interpreter. That was a pretty handy little notebook, and there are lots of them still hanging around.

The BASIC interpreter may not have been the most advanced in the world, but you could do a lot with it. I wrote a simple automobile payment program one Saturday morning, then took the Model 100 with me to the auto dealership that afternoon, and used it to calculate what my payments would be, based on an assumed interest rate and the sticker price of the car. It was pretty darned accurate too!

That was a great time to be in computers! Sometimes simple is good :-)

Forth
by dimosd on Sat 26th Aug 2006 00:22 in reply to "One more thought..."
dimosd Member since:
2006-02-10

8-bit home computers with built in Basic. These were the good times ;-)

Now about uBasic: If you are looking for a small, trivially portable interpreted language, there's Forth. More powerful than Basic, most would say. Weirder too.

Used in the 70s and 80s to make the best out of computers with 1KB RAM and a few Khz CPUs.
Nowadays used in BIOS, boot loaders (FreeBSD's loader and others), embedded and such.
Trivially portable: Most of Forth is written in Forth itself and you only need to implement a few hooks in assembly.
Can act as an OS for itself. Cooperative multitasking, nonetheless! Yet it fits in ROM or a few disk sectors.

Have a look, and have fun!

Reply Parent Bookmark Score: 2