Liberty BASIC (LB) is a commercial computer
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
and
integrated development environment
An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
(IDE). It has an
interpreter
Interpreting is translation from a spoken or signed language into another language, usually in real time to facilitate live communication. It is distinguished from the translation of a written text, which can be more deliberative and make use o ...
, developed in
Smalltalk
Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
, which recognizes its own
dialect
A dialect is a Variety (linguistics), variety of language spoken by a particular group of people. This may include dominant and standard language, standardized varieties as well as Vernacular language, vernacular, unwritten, or non-standardize ...
of the
BASIC
Basic or BASIC may refer to:
Science and technology
* BASIC, a computer programming language
* Basic (chemistry), having the properties of a base
* Basic access authentication, in HTTP
Entertainment
* Basic (film), ''Basic'' (film), a 2003 film
...
programming language. It runs on
16- and
32-bit
In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
OS/2
OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
.
Background
Liberty BASIC was written by Carl "Gunner" Gundel and published in its first release by his company, Shoptalk Systems, in 1991. 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 (DLLs) are available. In its current version, it runs only on
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
, and under Wine on Linux. Alpha testing of Liberty BASIC v5.0 is underway with versions that run on
Microsoft Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
Mac OS X
macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
, 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
* A visual development tool called FreeForm, written in Liberty BASIC and greatly extended by the Liberty BASIC community over the years
* Source level debugger
* calling of DLLs and
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
s (APIs)
* Color graphics capability
* Can create games with sprite animation, sound, music, and joystick control
* An add-on package called Assist with many new features, such as a code formatter, source code versioning, a performance profiler, an easy-to-use code difference browser, and an improved package and deployment system
Distinguishing features
Liberty BASIC allows for procedural programming 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
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
, 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
In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
for file handling. For example, (from the Liberty BASIC Help File):
"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. (The plan for LB v5 is to support other types and user defined types as well as these.) 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
* FreeForm, a GUI editor for creating GUI formats
Example code
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$(13) + "Hello, World!"
end
Program to display an input box:
nomainwin
prompt "Enter your name:"; response$
notice "Response:" + CHR$(13) + response$
end
Running another application:
nomainwin
run "notepad.exe"
end
Printing multiplication table of 5 on form:
ulti for i = 1 to 15
res = 5 * i
print res
next i
end
Alternative implementations
The GNU/Liberty Basic Compiler Collection (GLBCC), 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 2012 an alternative
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
implementation of Liberty BASIC, LB Booster (LBB), 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
BBC BASIC is an interpreted version of the BASIC programming language. It was developed by Acorn Computers Ltd when they were selected by the BBC to supply the computer for their BBC Literacy Project in 1981.
It was originally supplied on ...
.
LBB offers (typically) 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.
Liberty Basic does not provide for data declarations. Instead any new data name is treated as a new declaration. Some regard this as a benefit, others see it as a debugging issue for imperfect typers. In 2019 Peter J. D. Matthews devised a method for adding declarations and checking for undeclared data - without changing the code seen by the LB interpreter. In 2023 this system was ported to GitHub in public repository "LBPrePass" for anyone to use. This repository also contains program documentation. The program is written in Liberty Basic 4.5.1 and is intended to analyse 4.5.1 code.
References
External links
www.libertybasic.comnbsp;— official site
Carl Gundel's blogLiberty BASIC(in French)
Liberty BASICon
Rosetta Code
Rosetta Code is a wiki-based programming chrestomathy website with implementations of common algorithms and solutions to various computer programming, programming problems in many different programming languages. It is named for the Rosetta Stone ...
GNU/Liberty Basic Compiler Collection (GLBCC)LB Booster
{{Use mdy dates, date=March 2012
BASIC interpreters
BASIC programming language family