Tiny BASIC

Interpreter and Compiler Project

Final Remarks

The commands already covered all tell the computer what the program is supposed to do. But sometimes we need to keep notes for ourselves, too. Programs can get quite complicated, and the people we'd like to share a program with might not be able to see easily how it works. Indeed, if we return to the program after some weeks or months have passed, it may be difficult for us to understand it, too.

Comments are a feature not part of the original Tiny BASIC specification, but they were added to almost every extended version of Tiny BASIC, and the author of this project decided he couldn't do without them. The standard BASIC command to denote a comment is REM, short for remark. Like other commands, REM sits on a line on its own:

10 REM This program illustrates comments

Typical places you might use it are at the top of the program itself, to explain what the program does, and at the top of each subroutine. When a program can be logically split up into sections, each section benefits from a comment at the top. This can considerably speed up the task of finding a given section of your program, because you don't need to waste time interpreting those parts of a program that aren't what you're looking for.

Programmers of early computers would economise on comments because of the memory that they took up. Modern programmers don't have that excuse, as our computers have so much memory to play with that we'd have to be extremely verbose to overfill it.

There is one last feature that our Tiny BASIC project adds that is not at all common. While every line of our examples in this tutorial has a line number, in this version of Tiny BASIC they're optional; you only need to include line numbers that you're going to use in a GOSUB or a GOTO. This wasn't the case in most Tiny BASIC implementations, or even in some full-featured traditional BASIC dialects. You'll see many line numbers omitted in the BASIC sample programs bundled with the interpreter and compiler.

This tutorial should have given you a good start in understanding how to program in Tiny BASIC. Other documents, including the manual, will help you to examine some of the features of the language in depth.

Comments

New Comment

Yes No