Cliffer Basic

So many of us grew up typing BASIC into a Commodore 64, an Apple ][ or a TI-99/4A and watching what happened. That ready prompt was an invitation to try something. Cliffer Basic is my little tribute to those machines: a simple BASIC interpreter that you use the same way, one line at a time, at an interactive prompt.

It's also a demonstration of Cliffer, my library for writing command-line applications in .NET. Every BASIC statement is its own Cliffer command, and the interpreter's prompt is Cliffer's built-in REPL. If you want to see how far you can push a command-line library, making it pretend to be an 8-bit computer is a good test.

What it understands

You can type statements directly, or enter numbered lines to build a program and then run it, just like the old days. You can also run a saved program from the shell with clifferbasic run "hello.bas".

  • Program flow: for and next (with step), goto, gosub and return, if ... then, end, and rem.
  • Variables and input and output: let, print, and input, with number, integer and string variables, and arrays.
  • Editing programs: list, new, delete, run, save, load, and cls.
  • Files and folders: chgdir, chgvol, listdir, and printdir.

Commands aren't case-sensitive, so you can shout at it in capitals the way we used to.

What's next

I'd still like to add data and read, the : separator for putting several statements on one line, while and wend, and better help. At the moment most commands only work inside the interactive prompt, which is really something to fix in Cliffer itself.

Details

  • Written in C# for .NET 8, with Cliffer and DIAttrib, my attribute-based dependency-injection helper.
  • Build it from source; there's no package yet.
  • Licensed under MIT.

The code is on GitHub: github.com/paulmooreparks/ClifferBasic.