Yabasic
Encyclopedia
Yabasic is a free
and open source
BASIC interpreter
for Windows
and Unix
platforms. Yabasic was originally developed by Marc-Oliver Ihm, who released the last stable version 2.763 in 2005. As a continuation of the project, version 3 is now developed by a team centered around Pedro Sá and Thomas Larsen. The Yabasic interpreter is quite compact at about 250 kilobyte
s total.
In August 2007, Ihm stated that "probably (he) will not develop Yabasic any further (beyond version 2.763) within the foreseeable future", due to a lack of time. Sá and Larsen have revived the project, and currently work on Yabasic 3, and on releasing bugfixes for version 2.763. Several beta releases of version 3 have been released since December 2009.
Passing of arguments is always by value, except for arrays, which are always passed by reference.
The interpreter is very lenient in syntactical
matters—for example, both color and colour are legal variants for the same command. Likewise, there are a number of different versions for if and for constructs, giving the programmer freedom of choice in their design.
Yabasic's idiosyncratic way of accessing system variables with peek and poke-commands has been dropped in favour of reserved variable names. Old-style BASIC control flow features (goto, gosub, labels) are no longer supported. Declaration of variables prior to use can optionally be enforced.
print "Hello World"
The following example will calculate prime numbers,
print "This program will calculate the prime numbers below the limit"
input "limit: " limit
n=2
do
for i=2 to sqrt(n)
if (frac(n/i)=0) then
notprime=1
break
endif
next i
if notprime<>1 then
print n
endif
notprime=0
n=n+1
if n>limit break
loop
can be compiled into program code at runtime, allowing for self-modifying code.
For example, the sequence
x$= "sub printme \n print \"Hello world!\" \n end sub"
compile(x$)
would create a new procedure
,
sub printme
print "Hello world!"
end sub
while the program is running. This procedure can from this point on be invoked in either the 'traditional' way,
printme
or via the slightly more clever:
y$= "printme"
execute(y$)
toolkit called "Flyab" was under development. It would have been source-compatible with programs written in yab
, a variant of Yabasic that enables graphical programs to e written using the BeOS
API. Ports for Windows
, Mac OS X
, and Linux
were planned. Flyab added the ability to Yabasic to create native graphical user interfaces on all supported platforms. As of November 2008, the project appears to be halted.
with PS2 consoles in PAL territories.
Freeware
Freeware is computer software that is available for use at no cost or for an optional fee, but usually with one or more restricted usage rights. Freeware is in contrast to commercial software, which is typically sold for profit, but might be distributed for a business or commercial purpose in the...
and open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
BASIC interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
for Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
and Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
platforms. Yabasic was originally developed by Marc-Oliver Ihm, who released the last stable version 2.763 in 2005. As a continuation of the project, version 3 is now developed by a team centered around Pedro Sá and Thomas Larsen. The Yabasic interpreter is quite compact at about 250 kilobyte
Kilobyte
The kilobyte is a multiple of the unit byte for digital information. Although the prefix kilo- means 1000, the term kilobyte and symbol KB have historically been used to refer to either 1024 bytes or 1000 bytes, dependent upon context, in the fields of computer science and information...
s total.
History
Yabasic started as a very simple interpreter around May 1995. When it was released as version 1.0 it lacked many features like arrays and loops. In summer 1996, Yabasic was ported to the Win32 platform (Version 2.0). Further improvements were the addition of subroutines and libraries (summer 1999, version 2.57), and graphic capabilities.In August 2007, Ihm stated that "probably (he) will not develop Yabasic any further (beyond version 2.763) within the foreseeable future", due to a lack of time. Sá and Larsen have revived the project, and currently work on Yabasic 3, and on releasing bugfixes for version 2.763. Several beta releases of version 3 have been released since December 2009.
Features
- No line numbers,
- Line graphics2D computer graphics2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them...
in colour, - Structured programmingStructured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
—various block structures, named subroutines with local variables and return values, - Code modules/librariesLibrary (computer science)In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....
with separate namespacesNamespace (computer science)A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...
(On the other hand, composite data structuresComposite typeIn computer science, a composite data type is any data type which can be constructed in a program using its programming language's primitive data types and other composite types...
are missing), - Option to use a graphical user interfaceGraphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
based on the GTK library, - Self-modifying codeSelf-modifying codeIn computer science, self-modifying code is code that alters its own instructions while it is executing - usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, thus simplifying maintenance...
(see section below) - "Binding" a Yabasic program to the interpreter, creating a standalone executableExecutableIn computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful. These instructions are traditionally machine code instructions for a physical CPU...
in a single file.
Passing of arguments is always by value, except for arrays, which are always passed by reference.
The interpreter is very lenient in syntactical
Syntax
In linguistics, syntax is the study of the principles and rules for constructing phrases and sentences in natural languages....
matters—for example, both color and colour are legal variants for the same command. Likewise, there are a number of different versions for if and for constructs, giving the programmer freedom of choice in their design.
Yabasic 3
The most significant change from version 2 to version 3 is the introduction of user-defined data types.Yabasic's idiosyncratic way of accessing system variables with peek and poke-commands has been dropped in favour of reserved variable names. Old-style BASIC control flow features (goto, gosub, labels) are no longer supported. Declaration of variables prior to use can optionally be enforced.
Examples
The classic Hello World program looks like this in Yabasic,print "Hello World"
The following example will calculate prime numbers,
print "This program will calculate the prime numbers below the limit"
input "limit: " limit
n=2
do
for i=2 to sqrt(n)
if (frac(n/i)=0) then
notprime=1
break
endif
next i
if notprime<>1 then
print n
endif
notprime=0
n=n+1
if n>limit break
loop
Self-modifying code
String variablesString (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
can be compiled into program code at runtime, allowing for self-modifying code.
For example, the sequence
x$= "sub printme \n print \"Hello world!\" \n end sub"
compile(x$)
would create a new procedure
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....
,
sub printme
print "Hello world!"
end sub
while the program is running. This procedure can from this point on be invoked in either the 'traditional' way,
printme
or via the slightly more clever:
y$= "printme"
execute(y$)
Flyab
A port of Yabasic to the FltkFLTK
FLTK is a cross-platform GUI library developed by Bill Spitzak and others. Made with 3D graphics programming in mind, it has an interface to OpenGL, but it is also suitable for general GUI programming....
toolkit called "Flyab" was under development. It would have been source-compatible with programs written in yab
YAB
YAB or yab may refer to:* Arctic Bay Airport* Yamaguchi Asahi Broadcasting, A television station in Yamaguchi Prefecture, Japan* Yann Arthus-Bertrand , a French photographer* Youth Advisory Board...
, a variant of Yabasic that enables graphical programs to e written using the BeOS
BeOS
BeOS is an operating system for personal computers which began development by Be Inc. in 1991. It was first written to run on BeBox hardware. BeOS was optimized for digital media work and was written to take advantage of modern hardware facilities such as symmetric multiprocessing by utilizing...
API. Ports for Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
, Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
, and Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
were planned. Flyab added the ability to Yabasic to create native graphical user interfaces on all supported platforms. As of November 2008, the project appears to be halted.
PlayStation 2
Sony also packaged a version of Yabasic for the PlayStation 2PlayStation 2
The PlayStation 2 is a sixth-generation video game console manufactured by Sony as part of the PlayStation series. Its development was announced in March 1999 and it was first released on March 4, 2000, in Japan...
with PS2 consoles in PAL territories.
External links
- Official Yabasic website — downloads and documentation for Yabasic 2.763.
- Yabasic 3 website - downloads and documentation for the Version 3 interpreter.
- Yabasic manual — documentation for the interpreter.
- YAB interpreter — BeOSBeOSBeOS is an operating system for personal computers which began development by Be Inc. in 1991. It was first written to run on BeBox hardware. BeOS was optimized for digital media work and was written to take advantage of modern hardware facilities such as symmetric multiprocessing by utilizing...
/Haiku version of Yabasic. - Yabasic PS2 — site about the PS2 version.
- Small collection of Yabasic programs.
- Official website of flyab.