BASIC, short for Beginners All-Purpose Symbolic Instruction Code, is a programming language that was created in 1964 to enable college and university students without a STEM background to write software. Early versions of BASIC were interpreted and ran on time-sharing mainframe systems. Code was often input on teletype systems — essentially fancy printers that both displayed terminal output and took input from the user. Eventually this gave way to small "glass teletypes," that is, early CRT monitors.
The first dialects of BASIC were imperative in nature but not structured. That is, they lacked support for subroutines with signatures and return values. Use of line numbers as
GOTO jump targets resulted in difficult to follow "spaghetti code." Soon, on mainframe platforms at least, compiled dialects of BASIC became reasonably common. Some of these dialects retained the need for line-numbers, others used text-based line labels on an as-needed basis to allow the programmer to specify a jump target with a human readable name. This soon gave way to more structured ways of writing BASIC code.
From the late 1970's, at the dawn of the microcomputer revolution, early home-based computers with mere kilobytes of RAM often came with primitive versions of BASIC built into the system ROM. (A rare few preferred Forth instead.) Most of these interpreters were extremely spartan, owing to the memory and processing limitations of the day. Some versions of BASIC supported only integer math, while others fully supported floating point arithmetic. Some systems even lacked support for lower-case letters. Nearly all had reverted to line-number only versions of BASIC that indirectly discouraged structured programming.
At the time BASIC was seen as the Esperanto of programming languages. In theory, it was a nearly universal programming language among microcomputers. In practice, a unified BASIC standard did not exist and each microcomputer manufacturer added its own proprietary extensions for various reasons. This resulted in many dialects of basic that were similar, but just different enough to cause headaches for programmers porting programs between systems. Worse, moving source code between similar systems was problematic for several reasons: First, BASIC programs were not typically stored in plain text, there were very often tokenized. Each keyword corresponded to a single 8-bit value, typically somewhere between 0x80–0xff, but keyword mappings to byte assignments were not standardized. Second, disk formats were nothing if not incompatible and computer networks were uncommon at the time. So, even if existing tokenized source code could be converted to the target format physically getting it onto the target platform had its own challenges. This very often lead to source code being printed out and manually retyped on the target system followed by many rounds of debugging.
Throughout the 1980's and 1990's BASIC began to evolve. Some versions of the language were embedded into larger applications, others were intended for business use and supported both structured programming and object oriented paradigms. By the dawn of the world wide web, BASIC had lost most of its market share except as an introductory language to teach novice programmers. Serious business application development had shifted from compiled BASIC to COBOL and then to Java. System administration and reporting tasks had shifted from interpreted dialects of BASIC to Perl and shell scripts.
By the mid 1990's, these pressures forced BASIC to evolve. BASIC was forced to become structured, which allowed libraries (modules) to be shared among serious BASIC enthusiasts. Eventually, structured BASIC gave way to object oriented dialects of the language.
The sun has not set on BASIC. While it is true that Python has dethroned BASIC as the preferred introductory programming language, different BASIC dialects are still popular among some small business, hobbyists, and novice programmers. Perhaps surprisingly, modern BASIC dialects continue to live on and evolve in an embedded context within larger applications, most notably spreadsheets.
BASIC on Gentoo
Gentoo has a number of BASIC interpreters and compilers, each with its own strengths and weaknesses:
- dev-lang/bas — Bas is an open source classic BASIC dialect very much in the mold of the 1980's microcomputer era.
- app-office/libreoffice — an office suite with its own dialect of BASIC for internal application scripting.
- dev-lang/mono-basic — Mono BASIC is an open source Visual Basic.NET compiler with full object oriented BASIC support that integrates well with other languages that use the Mono runtime.
- dev-lang/fbc (GURU) — FreeBASIC is a popular modern cross-platform Object Oriented BASIC compiler with an optional QuickBASIC compatibility mode.
- FreeBASIC Manual — an in-depth language reference for the FreeBASIC language.
- LibreOffice BASIC Programming Guide — This dialect of BASIC is used extensively by LibreOffice as an embedded scripting language.
- C64 Wiki's BASIC v2 Guide — A detailed series of articles on a interpreted dialect of BASIC that was extremely popular in the early home microcomputing era of the late 1970's and early 1980's.
- BASIC Computer Games — ports of David H. Ahl's tremendously influential BASIC Computer Games to modern memory-safe programming languages. Original BASIC sources receive bug fixes and quality of life improvements. Ports to other languages tend to be in modern idiomatic programing styles of the target language with through comments to act a learning aid.
- Tokenized BASIC (HTTP) — details the structure of microcomputer BASIC file formats which usually represented BASIC keywords as single 8-bit values, called tokens, to speed parsing and save memory.
- BASIC (Re)Numbering with Commodore — A detailed analysis of BASIC lines as they exist in a linked-list of tokenized values. The article focuses on Commodore BASIC, but these implementation details were common to many early BASIC interpreters.