Skip to content

Tiny BASIC in Python: An interpreter, debugger, and linter for all your Tiny BASIC needs when coding in 1976!

License

Notifications You must be signed in to change notification settings

John-Robbins/tbp

Repository files navigation

Tiny BASIC in Python

Party like it's 1976!

Ancient Technology License: MIT mypy -strict Unit Test Count Code Coverage Percentage Code/Docs CI

Tiny BASIC in Python (tbp) is an implementation of the Tiny BASIC language first proposed by Dennis Allison in response to Bill Gate's "An Open Letter to Hobbyists." In 1976, Dr. Tom Pittman developed his version of Tiny BASIC, which was one of many developed at that time. He has graciously posted on his Tiny BASIC website OCR'd copies of documentation, programs, and much more about that exciting time in computer history, which provided the inspiration for tbp.

Where the original Tiny BASIC fit into 4K of memory, tbp is, ahem, a LOT larger, but does have a full debugger, linter, and runs on macOS, Linux, and Windows. So, pull up your bell bottom jeans, slap an 8-track tape into the stereo, and see what it was like for your grandparents when they programmed computers. Let's get groovy with the good vibes!

-----------------------------------------------------

💥 Tiny BASIC in Python in Action

As powerful as The Bionic Woman and The Six Million Dollar Man combined! (Play the bionic sound effect when watching the demo below.)

Feel the SIZZLE!

Tip: If you get lost at the tbp prompt, tbp:>, type %help to get the in-application help.

-----------------------------------------------------

✨ Features Galore

  • Supports all 12 statements and the two functions of the original, including USR.
  • Supports all 26 variables, A - Z. Why would anyone need more than that?
  • Loading and saving programs to/from disk. Feel free to make a pull request for cassette tape support.
  • A linter to help with program correctness.
    • Potential uninitialized variable usage.
    • Invalid GOTO and GOSUB address (i.e., line numbers).
    • Missing END in the program.
    • Using CLEAR in a program.
  • A complete debugger built in!
    • Breakpoints.
    • Single stepping.
    • Call stack.
    • Variable display (all 26!)
  • Line timings.
  • Runs all Tiny BASIC programs from the 1970s! 1
  • More documentation than you ever wanted!

-----------------------------------------------------

💻 Installation

It seemed nuts to put this up on PyPI, which is for important modules, not learning experiments. If you have the git executable for your operating system in your path, pip is happy to install directly from GitHub. Of course, you will want to have all this fun in a virtual environment so set that up first.

Installing from GitHub

% pip install git+https://github.com/John-Robbins/tbp.git

Cloning and Installing

Download the code from the Latest Releases. Expand the compressed file into a directory, then execute the following.

% pip install .

-----------------------------------------------------

📖 Documentation

Everything about tbp is lovingly documented to death in over 17,000 words in the GitHub Pages for this repository: https://John-Robbins.github.io/tbp.

👏 Acknowledgements

His glorious Crafting Interpreters book sparked my huge interest in programming languages. Bob wrote a book that perfectly threaded the needle between practical and theory and gives you the learning hooks to successfully move on to books like the Dragon Book and Engineering a Compiler. My rating: 5,000 ⭐! You will see Bob's influence all over this project. All the ugly and mistakes are all on me, not Bob.

He wrote a popular version of Tiny BASIC, but more importantly, uploaded old documentation and original programs that gave me the idea to focus on Tiny BASIC as a learning project.

Marco's TinyBasicBlazor, a WebAssembly port of Tiny BASIC, was a huge help in helping me understand lots of edge cases in Tiny BASIC behavior. I hope I didn't eat too much bandwidth at your site Marco, because I felt I was there a lot! His Day of the Week program helped me uncover a major bug in my code, too.

Coverage.py is one of those perfect software tools. As an absolute Python beginner, it took me less than five minutes to get it running and made me a better Python developer. Also, when I was trying to learn GitHub Actions, his scriv project is a great example. Not too complicated, but more complete than the documentation.

❤️ YOU! ❤️

Thank you so much for looking at tbp. It's my first Python project and first time using GitHub Actions so any feedback on what I can do better, or what I did wrong, is greatly appreciated. Hit me up in the Issues.

To all of you, thanks! I'm a Python beginner standing on the shoulders of giants!

-----------------------------------------------------

📄 Legal

Dr. Pittman holds the copyright to his implementation of Tiny BASIC:

TinyBasic interpreter Copyright 1976 Itty Bitty Computers, used by permission.

The license for all the code in this repository is under the MIT license.

Footnotes

  1. Except the absolutely wild and crazy Tiny BASIC IL assembler.