FreeBASIC

Last updated
FreeBASIC
Fblogo.gif
FreeBasic help.png
Paradigm Procedural, object-oriented
Designed by Andre Victor [1]
Developer The FreeBASIC Development Team
First appeared2004;20 years ago (2004)
Stable release
1.10.1 / December 25, 2023;16 days ago (2023-12-25)
Typing discipline Static
OS MS-DOS, FreeBSD, Linux, Microsoft Windows
License GNU GPLv2+, Standard libraries licensed under the GNU LGPLv2+
Website www.freebasic.net
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]

Contents

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] IDEs specifically made for FreeBASIC include FBide and FbEdit, [5] while more graphical options include WinFBE Suite and VisualFBEditor. [6] [7]

Compiler features

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.

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.

Syntax

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. [8] New features include support for concepts such as objects, operator overloading, function overloading, namespaces and others. [9]

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.

Graphics library

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.

Language dialects

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:

Example code

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.

Related Research Articles

<span class="mw-page-title-main">Blitz BASIC</span>

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.

An integrated development environment (IDE) is a software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, and a debugger. Some IDEs, such as IntelliJ IDEA, Eclipse and Lazarus contain the necessary compiler, interpreter or both; others, such as SharpDevelop, NetBeans do not.

<span class="mw-page-title-main">Oberon (programming language)</span>

Oberon is a general-purpose programming language first published in 1987 by Niklaus Wirth and the latest member of the Wirthian family of ALGOL-like languages. Oberon was the result of a concentrated effort to increase the power of Modula-2, the direct successor of Pascal, and simultaneously to reduce its complexity. Its principal new feature is the concept of type extension of record types. It permits constructing new data types on the basis of existing ones and to relate them, deviating from the dogma of strictly static typing of data. Type extension is Wirth's way of inheritance reflecting the viewpoint of the parent site. Oberon was developed as part of the implementation of an operating system, also named Oberon at ETH Zurich in Switzerland. The name was inspired both by the Voyager space probe's pictures of the moon of the planet Uranus, named Oberon, and because Oberon is famous as the king of the elfs.

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.

<span class="mw-page-title-main">Liberty BASIC</span>

Liberty BASIC (LB) is a commercial computer programming language and integrated development environment (IDE). 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.

<span class="mw-page-title-main">QuickBASIC</span> IDE for the BASIC programming language

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.

<span class="mw-page-title-main">PowerBASIC</span> Software compiler

PowerBASIC, formerly Turbo Basic, is the brand of several commercial compilers by PowerBASIC Inc. that compile a dialect of the BASIC programming language. There are both MS-DOS and Windows versions, and two kinds of the latter: Console and Windows. The MS-DOS version has a syntax similar to that of QBasic and QuickBASIC. The Windows versions use a BASIC syntax expanded to include many Windows functions, and the statements can be combined with calls to the Windows API.

<span class="mw-page-title-main">Gambas</span> Integrated development environment

Gambas is the name of an object-oriented dialect of the BASIC programming language, as well as the integrated development environment that accompanies it. Designed to run on Linux and other Unix-like computer operating systems, its name is a recursive acronym for Gambas Almost Means Basic. Gambas is also the word for prawns in the Spanish, French, and Portuguese languages, from which the project's logos are derived.

<span class="mw-page-title-main">Delphi (software)</span> General-purpose programming language and a software product

Delphi is a general-purpose programming language and a software product that uses the Delphi dialect of the Object Pascal programming language and provides an integrated development environment (IDE) for rapid application development of desktop, mobile, web, and console software, currently developed and maintained by Embarcadero Technologies.

Object Pascal is an extension to the programming language Pascal that provides object-oriented programming (OOP) features such as classes and methods.

<span class="mw-page-title-main">Free Pascal</span> Free compiler and IDE for Pascal and ObjectPascal

Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, with exception clauses that allow static linking against its runtime libraries and packages for any purpose in combination with any other software license.

C# and Visual Basic .NET are the two primary languages used to program on the .NET Framework.

<span class="mw-page-title-main">Visual Basic (classic)</span> Event-driven programming language

The original Visual Basic is a third-generation event-driven programming language from Microsoft known for its Component Object Model (COM) programming model first released in 1991 and declared legacy during 2008. Microsoft intended Visual Basic to be relatively easy to learn and use. Visual Basic was derived from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects.

<span class="mw-page-title-main">FutureBASIC</span>

FutureBasic is a free BASIC compiler for Apple Inc.'s Macintosh.

<span class="mw-page-title-main">QB64</span> IDE for the BASIC programming language

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.

Basic4ppc is a programming language originally for Pocket PC handheld computers running Windows Mobile operating system, by Anywhere Software. Since 2014, B4x was renamed, and currently, 2023, supports multiple devices and their OS, including desktop and mobile solutions with development adaptions for these environments. The language is based on a BASIC-like syntax, taking advantage of Microsoft's .NET technology, to allow additional libraries, graphical user interface design of windows forms, rapid application development (RAD), and .NET framework compatible compilation. The language implements a unique way of adding objects to a program without being object-oriented. Its advantages are simplicity, development pace and the integration with .NET framework. A special version of the integrated development environment (IDE) allows developing straight onto the Windows Mobile device or. With the demise of Windows Mobile operating system and the devices running it Basic4PPC came to the end of its life in about 2012. For owners of Basic4PPC it remains a useful Windows-desktop BASIC compiler as it runs code directly in the Windows environment and it can compile a project to a Windows 'exe' file for use as a Windows program.

<span class="mw-page-title-main">QBasic</span> IDE for the BASIC programming language

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.

<span class="mw-page-title-main">Red (programming language)</span> Computer programming language released in 2011

Red is a programming language designed to overcome the limitations of the programming language Rebol. Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and functional programming language. Its syntax and general usage overlaps that of the interpreted Rebol language.

References

  1. "freeBASIC about page". freeBASIC compiler. Retrieved 5 February 2012.
  2. FBWiki : FaqPgxbox
  3. freeBASIC Programming Language: Official Web site
  4. "freeBASIC official website downloads page". freeBASIC compiler. Retrieved 13 May 2017.
  5. FbEdit on sourceforge, retrieved 13 May 2017
  6. Speed, Richard (2022-05-06). "RAD Basic – the Visual Basic 7 that never was – releases third alpha". The Register . Retrieved 2023-03-26. RAD Basic is not the only game in town. Alternatives in varying stages of development include twinBASIC, which also aims to be backwards compatible with VB6 and VBA; and FreeBASIC, which implements much of what lurked in Microsoft QuickBASIC (and has a nifty IDE in the form of VisualFBEditor).
  7. FreeBASIC IDEs/Editors - FreeBASIC Forums
  8. "freeBASIC dialects". coderJeff's home page. Retrieved 5 February 2012.
  9. "Differences from QB". freeBASIC.net documentation. Retrieved 5 February 2012.
IDEs