mjdxp - BASIC Interpreter in Scratch


This page is dedicated to showing off my BASIC interpreter written in Scratch, as well as providing usage instructions!

Important Note: This page follows the Scratch community guidelines, however other links on this website may not fully follow them. Additionally, I can't make any guarantees for content on externally linked websites. If you came here from the Scratch project's description, please stay on this page.

Looking to play with the interpreter? You can do that with this embedded Scratch project. Note that if you want to save/import a program, you'll need to use it on the Scratch project page so you can click the "See inside" button. Click here to go to the version on the Scratch website.

Usage Instructions

A line in BASIC is made of three parts: the line number, the command, and the arguments. For example:

  10 print "Hello, world!"

This line means when the interpreter gets to line 10, it will print out the message "Hello, world!" to the console.

A BASIC program is run in order from the highest line to the lowest line. For example:

  10 print "Hello,"
  20 print "world!"

will print "Hello," on the first line, then "world!" on the second line.

It's okay (and even encouraged) to skip numbers. Most BASIC programmers use multiples of ten to make it easier to insert lines in between other lines in case you want to add something.

If you want to edit a line, you can just retype it and it will replace whatever line you previously entered.

To see a listing of everything you've entered so far, you can type "list". This is a special command that doesn't require a line number. Other such special commands include "clear" to clear the console (while leaving your program intact), "new" to clear out your program and start over, and "run" to run your program.

Command list

print

The "print" command lets you print strings or variables to the screen:

UNDER CONSTRUCTION