Yabasic: Yet Another BASIC

yabasic is a traditional basic interpreter. It understands most of the typical basic-constructs, like goto, gosub, line numbers, read, data or string-variables with a trailing ‘$’. But on the other hand, yabasic implements some more advanced programming-constructs like subroutines or libraries (but not objects). yabasic works much the same under Unix and Windows.

yabasic does simple graphics and printing.

yabasic puts emphasis on giving results quickly and easily; therefore simple commands are provided to open a graphic window, print the graphics or control the console screen and get keyboard or mouse information.

Major features:

  • Print, input and others – the print-command is used to put text on the text screen. You may ask the user for input with the input-command; use inkey$ to get each key as soon as it is pressed.
  • Control statements: loops, if and switch – has the goto- and gosub-statements; you may go to a label or a line number (which is just a special kind of label). goto, despite its bad reputation ([goto considered harmful]), has still its good uses; however in many cases you are probably better off with loops like repeat-until, while-wend or do-loop; you may leave any of these loops with the break-statement or start the next iteration immediately with continue. Decisions can be made with the if-statement, which comes either in a short and a long form. If you want to test the result of an expression against many different values, you should probably use the switch-statement.
  • Drawing and painting – draw anything with either line, circle, rectangle or triangle; all of these statements may be decorated with clear or fill. If you want to change the colour for drawing, use colour.
  • Reading from and writing to files
  • Subroutines and Libraries – subroutines are created with the command sub. they accept parameters and may return a value. Subroutines can be called much like any builtin function of yabasic; therefore they allow one to extend the language itself. Once you have created a set of related subroutines and you feel that they could be useful in other programs too, you may collect them into a library. Such a library is contained within a separate file and may be included in any of your programs, using the keyword import.
  • String processing – has the usual functions to extract parts from a string: left$, mid$ and right$. There are other string-processing functions like upper$ (converting to upper case), instr (finding one string within the other), chr$ (converting an ascii-code into a character), glob (testing a string against a pattern) and more.
  • Arithmetic – handles numbers and arithmetic: You may calculate trigonometric functions like sin or atan, or logarithms (with log). Bitwise operations, like and or or are available as well min or max (calculate the minimum or maximum of its argument) or mod or int (reminder of a division or integer part or a number).
  • Data and such – store data within your program within data-statements; during execution you will probably want to read it into arrays, which must have been dimed before.

Website: www.yabasic.de
Support: Manual, FAQ
Developer: Many contributors
License: MIT License