Paradigm | Procedural, object-oriented |
---|---|
Designed by | Andre Victor [1] |
Developer | The FreeBASIC Development Team |
First appeared | 2004 |
Stable release | 1.10.1 / December 25, 2023 |
Typing discipline | Static |
OS | MS-DOS, FreeBSD, Linux, Microsoft Windows |
License | GNU GPLv2+, Standard libraries licensed under the GNU LGPLv2+ |
Website | www |
Influenced by | |
QuickBASIC, C |
FreeBASIC is a free and open source multiplatform compiler and programming language based on BASIC licensed under the GNU GPL for Microsoft Windows, protected-mode MS-DOS (DOS extender), Linux, FreeBSD and Xbox. The Xbox version is no longer maintained. [2]
According to its official website, [3] FreeBASIC provides syntax compatibility with programs originally written in Microsoft QuickBASIC (QB). Unlike QuickBASIC, however, FreeBASIC is a command line only compiler, unless users manually install an external integrated development environment (IDE) of their choice. [4]
On its backend, FreeBASIC makes use of GNU Binutils in order to produce console and graphical user interface applications. FreeBASIC supports the linking and creation of C static and dynamic libraries and has limited support for C++ libraries. As a result, code compiled in FreeBASIC can be reused in most native development environments.
While not an optimizing compiler, FreeBASIC can optionally transcompile to C to compile with optimizations. FreeBASIC supports inline assembly, multi-threading, and does not use automatic garbage collection.
C style preprocessing, including multiline macros, conditional compiling and file inclusion, is supported. The preprocessor also has access to symbol information and compiler settings, such as the language dialect.
Initially, FreeBASIC emulated Microsoft QuickBASIC syntax as closely as possible. Beyond that, the language has continued its evolution. As a result, FreeBASIC combines several language dialects for maximum level of compatibility with QuickBASIC and full access to modern features. [5] New features include support for concepts such as objects, operator overloading, function overloading, namespaces and others. [6]
Newline characters indicate the termination of programming statements. A programming statement can be distributed on multiple consecutive lines by using the underscore line continuation char (_), whereas multiple statements may be written on a single line by separating each statement with a colon (:).
Block comments, as well as end-of-line remarks are supported. Full line comments are made with an apostrophe '
, while blocks of commented code begin with /'
and end with '/
.
FreeBASIC is not case-sensitive.
FreeBASIC provides built-in, QuickBASIC compatible graphics support through FBgfx, which is automatically included into programs that make a call to the SCREEN
command. Its backend defaults to OpenGL on Linux and DirectX on Microsoft Windows. This abstraction makes FBgfx graphics code cross-platform compatible. However, FBgfx is not hardware accelerated.
Users familiar with external graphics utilities such as OpenGL or the Windows API can use them without interfering with the built-in graphics library.
As FreeBASIC has evolved, changes have been made that required breaking older-styled syntax. In order to continue supporting programs written using the older syntax, FreeBASIC now supports the following dialects:
GOSUB
/ RETURN
, numeric labels and other features are allowed in this dialect.Standard programs, such as the "Hello, World!" program are done just as they were in QuickBASIC.
Print"Hello, World!"sleep:end'Comment, prevents the program window from closing instantly
FreeBASIC adds to this with support for object-oriented features such as methods, constructors, dynamic memory allocation, properties and temporary allocation.
TypeVectorPrivate:xAsIntegeryAsIntegerPublic:DeclareConstructor(nXAsInteger=0,nYAsInteger=0)DeclarePropertygetXAsIntegerDeclarePropertygetYAsIntegerEndTypeConstructorVector(nXAsInteger,nYAsInteger)x=nXy=nYEndConstructorPropertyVector.getXAsIntegerReturnxEndPropertyPropertyVector.getYAsIntegerReturnyEndProperty
DimAsVectorPtrplayer=NewVector()*player=Type<Vector>(100,100)Printplayer->getXPrintplayer->getYDeleteplayerSleep'Prevents the program window from closing instantly
In both cases, the language is well suited for learning purposes.
Applesoft BASIC is a dialect of Microsoft BASIC, developed by Marc McDonald and Ric Weiland, supplied with Apple II computers. It supersedes Integer BASIC and is the BASIC in ROM in all Apple II series computers after the original Apple II model. It is also referred to as FP BASIC because of the Apple DOS command FP
used to invoke it, instead of INT
for Integer BASIC.
BASIC is a family of general-purpose, high-level programming languages designed for ease of use. The original version was created by John G. Kemeny and Thomas E. Kurtz at Dartmouth College in 1963. They wanted to enable students in non-scientific fields to use computers. At the time, nearly all computers required writing custom software, which only scientists and mathematicians tended to learn.
Blitz BASIC is the programming language dialect of the first Blitz compilers, devised by New Zealand–based developer Mark Sibly. Being derived from BASIC, Blitz syntax was designed to be easy to pick up for beginners first learning to program. The languages are game-programming oriented, but are often found general-purpose enough to be used for most types of application. The Blitz language evolved as new products were released, with recent incarnations offering support for more advanced programming techniques such as object-orientation and multithreading. This led to the languages losing their BASIC moniker in later years.
Dylan is a multi-paradigm programming language that includes support for functional and object-oriented programming (OOP), and is dynamic and reflective while providing a programming model designed to support generating efficient machine code, including fine-grained control over dynamic and static behaviors. It was created in the early 1990s by a group led by Apple Computer.
GW-BASIC is a dialect of the BASIC programming language developed by Microsoft from IBM BASICA. Functionally identical to BASICA, its BASIC interpreter is a fully self-contained executable and does not need the Cassette BASIC ROM found in the original. It was bundled with MS-DOS operating systems on IBM PC–compatibles by Microsoft.
Pascal is an imperative and procedural programming language, designed by Niklaus Wirth as a small, efficient language intended to encourage good programming practices using structured programming and data structuring. It is named after French mathematician, philosopher and physicist Blaise Pascal.
Lua is a lightweight, high-level, multi-paradigm programming language designed mainly for embedded use in applications. Lua is cross-platform software, since the interpreter of compiled bytecode is written in ANSI C, and Lua has a relatively simple C application programming interface (API) to embed it into applications.
Microsoft QuickBASIC is an Integrated Development Environment and compiler for the BASIC programming language that was developed by Microsoft. QuickBASIC runs mainly on DOS, though there was also a short-lived version for the classic Mac OS. It is loosely based on GW-BASIC but adds user-defined types, improved programming structures, better graphics and disk support and a compiler in addition to the interpreter. Microsoft marketed QuickBASIC as the introductory level for their BASIC Professional Development System. Microsoft marketed two other similar IDEs for C and Pascal, viz QuickC and QuickPascal.
Microsoft BASIC is the foundation software product of the Microsoft company and evolved into a line of BASIC interpreters and compiler(s) adapted for many different microcomputers. It first appeared in 1975 as Altair BASIC, which was the first version of BASIC published by Microsoft as well as the first high-level programming language available for the Altair 8800 microcomputer.
F# is a general-purpose, high-level, strongly typed, multi-paradigm programming language that encompasses functional, imperative, and object-oriented programming methods. It is most often used as a cross-platform Common Language Infrastructure (CLI) language on .NET, but can also generate JavaScript and graphics processing unit (GPU) code.
IDL, short for Interactive Data Language, is a programming language used for data analysis. It is popular in particular areas of science, such as astronomy, atmospheric physics and medical imaging. IDL shares a common syntax with PV-Wave and originated from the same codebase, though the languages have subsequently diverged in detail. There are also free or costless implementations, such as GNU Data Language (GDL) and Fawlty Language (FL).
Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.
C# and Visual Basic (.NET) are the two main programming languages used to program on the .NET framework.
This comparison of programming languages (array) compares the features of array data structures or matrix processing for various computer programming languages.
FutureBasic is a free BASIC compiler for Apple Inc.'s Macintosh.
QB64 is a self-hosting BASIC compiler for Microsoft Windows, Linux and Mac OS X, designed to be compatible with Microsoft QBasic and QuickBASIC. QB64 is a transpiler to C++, which is integrated with a C++ compiler to provide compilation via C++ code and GCC optimization.
QBasic is an integrated development environment (IDE) and interpreter for a variety of dialects of BASIC which are based on QuickBASIC. Code entered into the IDE is compiled to an intermediate representation (IR), and this IR is immediately executed on demand within the IDE.
A BASIC interpreter is an interpreter that enables users to enter and run programs in the BASIC language and was, for the first part of the microcomputer era, the default application that computers would launch. Users were expected to use the BASIC interpreter to type in programs or to load programs from storage.
Cg and High-Level Shader Language (HLSL) are two names given to a high-level shading language developed by Nvidia and Microsoft for programming shaders. Cg/HLSL is based on the C programming language and although they share the same core syntax, some features of C were modified and new data types were added to make Cg/HLSL more suitable for programming graphics processing units.