Logo

dev-resources.site

for different kinds of informations.

Is MiniScript a dialect of BASIC?

Published at
10/18/2023
Categories
miniscript
programming
basic
retro
Author
joestrout
Author
9 person written this
joestrout
open
Is MiniScript a dialect of BASIC?

I've recently been working on converting 100 classic BASIC computer games to MiniScript. Also, I continue to work periodically on refining MiniBASIC. All this has led me to hang out with some other BASIC enthusiasts in a Facebook group, and I got asked the question: is MiniScript a dialect of BASIC?

It's an interesting question. The MiniScript language is a clean-sheet design, not intended to derive or extend any particular previous language. But it certainly drew inspiration from various languages, including REALbasic (where I was chief engineer for a number of years). In my "Why MiniScript?" post, I called out Python, Lua, REALbasic, and C# as particular examples (though I drew from other languages too -- anybody remember MOO?).

So. Does this make MiniScript a BASIC language or not? I guess it depends on what you consider to be the defining characteristics of a modern BASIC. Let's argue it both ways.

BASIC It Is

Modern BASICs (like Xojo, Visual Basic, etc.) have outgrown line numbers and GOTO, instead using flow control based on keywords. These include if-then, generally terminated with end if. And that is exactly what MiniScript does too.

if 2+2 == 4 then
    print "math works!"
else if pi > 3 then
    print "pi is tasty"
else if "a" < "b" then
    print "I can sort"
else
    print "last chance"
end if
Enter fullscreen mode Exit fullscreen mode

The same applies to while loops, though some BASICs use wend, MiniScript uses a more consistent end while.

s = "Spam"
while s.len < 50
    s = s + ", spam"
end while
print s + " and spam!"
Enter fullscreen mode Exit fullscreen mode

Also like modern BASICs, a subroutine call can be made without parentheses, enabling a PRINT statement that looks almost exactly like BASICs of yore (see listings above).

More generally, BASIC — true to its name (Beginner's All-purpose Symbolic Instruction Code) — is known for being simple and easy to pick up, with very little extraneous syntax and punctuation. MiniScript has that same quality. So in this abstract (and admittedly subjective) sense, at least, MiniScript is true to the spirit of BASIC.

BASIC It Ain't

BASIC languages, to my knowledge, have always been statically typed. Even in old-school BASIC, while you don't need to declare your variables, they are typed by their very names: X is a number while X$ is a string, and X$() is an array of strings.

MiniScript, on the other hand, is dynamically typed. X could be any value, and it can even change from one type to another over the course of the program, like in this snippet where inp starts out a string (the result of input), and morphs into a number.

inp = input("Enter a number (or hit return for 42: ")
if inp == "" then
   inp = 42
else
   inp = inp.val
end if
Enter fullscreen mode Exit fullscreen mode

Next, let's consider core datatypes. Modern BASICS generally have core types of string, integer, float, and arrays of same. MiniScript's core types are string, number, list, and map. This set of four core types, it turns out, is really important to the character of a modern scripting language. Lists and maps can easily substitute for almost any common data structure: arrays, queues, stacks, sets, even classes and objects. Modern BASICs work quite differently; they have statically-declared container classes and such, more similar to something like C# than to MiniScript.

So in these ways, MiniScript is much more Python than BASIC.

Conclusion

So, is MiniScript a variant of BASIC or not? I guess that is in the eye of the beholder. I can tell you that when porting those 100 BASIC computer games, in many cases, the old BASIC code translated directly into MiniScript with no fuss. But at other times — mainly when the original code was a mess of GOTOs and THEN-jumps — it was a royal pain.

If you're coming from a BASIC background, but looking for a simple, quick scripting language where you can just hack around without declaring variables and data structures ahead of time, I think you'll feel right at home in MiniScript. And perhaps that's all that matters!

retro Article's
30 articles in total
Favicon
Cowboy Casino Major Update
Favicon
A Year of Adventuring: 2024 in Review
Favicon
Menu de Game Retrô com Godot4
Favicon
Cowboy Casino Major Update
Favicon
Smoke for pseudo 3d arcade
Favicon
¡BASIC cumple 60 años!
Favicon
Is Retro Bowl Still Worth Playing in 2024?
Favicon
Descansa en Paz, Z80
Favicon
Hackeando en 8 bits (y II)
Favicon
Making a program with Blipsy
Favicon
Exploring GOTO: A Journey into the Prehistory of Programming
Favicon
Hackeando en 8 bits
Favicon
The Best GameBoy Emulators: SameBoy, VisualBoy and More
Favicon
Build a Retro Calculator !!
Favicon
An Old-school CRT terminal with Vitepress?!
Favicon
Is MiniScript a dialect of BASIC?
Favicon
Programando en Turbo Assembler en los 90
Favicon
Cuando tenías un CRT de 17"
Favicon
Writing a NES game, day 8
Favicon
Writing a NES game day 7, chr files
Favicon
DIY Retro Gaming Console: Transform Your Old PC or Laptop Into an Arcade with Batocera Linux
Favicon
Decimal to binary and hexadecimal converter on the Apple ][ - Part 1
Favicon
Je veux des paillettes dans mes rétros ✨
Favicon
PICO-8 Game : Tomato Run
Favicon
Retro Computing is Fun
Favicon
A Brief Introduction to DurexForth for the Commodore 64
Favicon
How to get your Mallsoft .wav files to play for Winamp 🦙 2.9.5 in Windows 98SE
Favicon
Debugging GameBoy Advance (GBA) programs/games in Emacs
Favicon
#JulyOT 26: Let's get personal: Computing - Retro computing with Dave Glover and the Altair 8800
Favicon
Retro BSD Games and other text mode games.

Featured ones: