Liberty BASIC


Liberty BASIC is a commercial computer programming language and integrated development environment. It has an interpreter, developed in Smalltalk, which recognizes its own dialect of the BASIC programming language. It runs on 16- and 32-bit Windows and OS/2.

Background

Liberty BASIC was written by Carl Gundel and published in its first release by his company, Shoptalk Systems, in 1992. It has progressed steadily since then. to the software, version 4.5.1, was in June 2018.
Though Liberty BASIC has its share of limitations in its design for advanced programming, it provides an introductory integrated development environment, IDE, for moderate to advanced users of Windows and OS/2. Dynamic-link libraries are available. In its current version, it runs only on Microsoft Windows, and under Wine on Linux. Alpha testing of Liberty BASIC v5.0 is underway with versions that run on Microsoft Windows, Mac OS X, Linux and on the Raspberry Pi as well.
Liberty BASIC does not compile to native code. Instead it compiles the code written in the IDE to an encrypted file with the extension TKN. This file is then executed by an EXE file that carries the same file name, although this may change with the release of version 5.

Features

Liberty BASIC allows for programming in a style similar to DOS BASICs that run in console mode, using a default "main window" that displays formatted text and accepts user input. It also supports event-driven programming based on a graphical user interface, using several types of windows that may contain the standard controls such as buttons, menus, textboxes, etc.
A central idea in creating Liberty BASIC was to model the handling of windows after the syntax for file handling. For example, :
"The OPEN command opens communication with a device, which can be a disk file, a window, a dynamic-link library or a serial communications port."
OPEN device FOR purpose AS #handle
Once a “device” is open, data and also commands to control that device can be “printed” to it. For each type of device there is a set of commands which can be sent to it in this way. In the more recent versions of LB the word "print" may be dropped from the "print" statement, making the syntax even simpler.
Simplicity has been at the heart of Liberty BASIC from the beginning. This makes it easier to learn but at some cost, perhaps, in limiting functionality. Only two data types are supported in LB v4.03 — numeric and string. No type declarations are required; any variable with a $ sign at the end of its name is a string variable, otherwise it is numeric. For the purpose of making calls to an API or third-party DLLs there is a STRUCT and the additional types necessary for the DLL. The only other data structure supported is the ARRAY. Arrays of one or two dimensions are supported. LB v5 may support arrays of user-defined types.

Notable programs written in Liberty BASIC

Here are some examples of the language:
"Hello, World!" program:
print "Hello, World!"
end

Program to display a pop-up message box with the words "Hello, World!" on it:
nomainwin
notice "Hello, World!"
end

nomainwin
notice "Example program" + CHR$ + "Hello, World!"
end

Program to display an input box:
nomainwin
prompt "Enter your name:"; response$
notice "Response:" + CHR$ + response$
end

Running another application using Liberty BASIC:
nomainwin
run "notepad.exe"
end

Printing multiplication table of 5 on form:

for i = 1 to 10
res = 5 * i
print res
next i
end

Alternative implementations

The GNU/Liberty Basic Compiler Collection, by Anthony Liguori, is a set of tools to compile Liberty Basic programs, runs on Windows and Linux systems, but the project has not been updated since 2001.
In 2011 an alternative Windows implementation of Liberty BASIC, LB Booster, became available. Although substantially compatible with the Liberty BASIC 4 language syntax, LBB was developed entirely independently by Richard Russell and is written in BBC BASIC.
LBB offers increased execution speed, smaller self-contained executables and some additional capabilities. However LBB is not 100% compatible with LB4 and while many programs will run without modification, some may need to be adapted, or may even be unsuitable for running under LBB.