Yabasic

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Yabasic
Samegame yabasic example.png
Yabasic running an implementation of SameGame.
Developer(s) Marc-Oliver Ihm (ret.)
Pedro Sá
Thomas Larsen
Stable release 2.768 / May, 2014
Operating system Windows, Unix
Type Programming
License GNU General Public License version 3 or later
Website www.yabasic.de - original version to V 2.768
yabasic.basicprogramming.org - version 3

Yabasic (Yet Another BASIC) is a free and open source BASIC interpreter for Windows and Unix platforms.[1] Yabasic was originally developed by Marc-Oliver Ihm, who released the last stable version 2.768 in 2014. 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 kilobytes total.

History[edit]

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,[2] and on releasing bugfixes for version 2.763.[3] Several beta releases of version 3 have been released since December 2009.[4]

As of February 2014, Ihm has updated the original version of Yabasic in January 2014 with regard to bugfixes and its toolchain and has stated his intent to keep it up to date with regard to maintenance[5] while no new version of Yabasic 3 has been published by Larsen despite his announcement to do so on 24 December 2013.[6]

Features[edit]

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 3[edit]

The most significant change from version 2 to version 3 is the introduction of user-defined data types.[7]

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[edit]

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[edit]

String variables 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$)

Other versions[edit]

Flyab[edit]

A port of Yabasic to the Fltk 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 be 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.[citation needed] As of November 2008, the project appears to be halted.

PlayStation 2[edit]

Sony also packaged a version of Yabasic for the PlayStation 2 with PS2 consoles in PAL territories.

References[edit]

  1. ^ Marc-Oliver Ihm. "Yabasic, Yet another Basic for Unix and Windows". Yabasic.de. Retrieved 2013-04-22. 
  2. ^ Wiki of the developer team for Yabasic 3 www.basicprogramming.org
  3. ^ Yabasic::Dev Article Future of Yabasic www.basicprogramming.org
  4. ^ Announcement: Yabasic 3 beta release (2.9.5) Thomas H. Larsen, via basicprogramming.org forum, 26 November 2009, forum.basicprogramming.org
  5. ^ Official Yabasic website
  6. ^ Yabasic 3 website of Thomas Larsen
  7. ^ Tutorial on how to create UDTs in Yabasic 3 www.basicprogramming.org

External links[edit]