Home - SamuraiCrow/Yab2Cpp GitHub Wiki
Yab2C++
Yab2C++ is a pass-and-a-half compiler for translating Yab (Yet Another BASIC) into C++ for any CPU architecture that the Haiku operating system supports. Yab was orignally written as a BASIC interpreter for Windows and Unix clones called YABASIC. The BeOS developers didn't want their users to be stuck writing a difficult programming language like C++ for all of their programs so they modified the original YABASIC interpreter to use native BeOS graphical widgets for making GUI based applications and to satisfiy the licensing requirements, they shortened the name to Yab.
Because the source code is still available under the original licensing terms, members of the Haiku community have maintained the Yab interpreter and added some features. Among these are audio streaming and updated GUI developments. Starting with version 1.8, the backward compatibility to BeOS Zeta and BeOS R5 will be dropped in favor of a Haiku native BASIC. One thing this plan has lacked, is that the interpreter could only make native apps by binding the interpreter with the source code in one archived file. I have started to project to fix that.
While there are some commands that cannot run in a compiled version of a Yab program, they are rarely used anyway. The chief one being the Eval command which evaluates an expression from a string variable passed in to an executable function returning a result, either in string or numeric form. For obvious reasons these cannot be compiled in advance. Excluding those commands, the rest of the language can be converted to C++ in the effort to allow GCC or Clang to optimize the results into something that runs more quickly.
Be sure to read the other article in this wiki that describe the compilation strategy to convert a merely semi-structured language like BASIC to a very structured and object-oriented language like C++. You may find it to be an enlightening and educational experience.