Embeddable and Extensible Basic Interpreter

Environment: Win32, MS Visual C++ 6.0

Sometimes to add new features to an application we need more than to just add new buttons to toolbar. One of the ways to ultimately extend application's capabilities is to add scripting language to it. BeeBasic embeddable basic interpreter is one of the tools that can be used for this purpose.

BeeBasic is made to be embedded in into GUI applications. It creates terminal window to process input and print statements, and dialog widow for its dialog statement (with dialog you can input several vales at a time).

BeeBasic was made to be embedded. By adding extensions you can call your application's functions and manipulate application's objects from script. Thare are four kinds of extensions you can add to BeeBasic: constants, subs, functions and objects. I tried to make the process as simple as possible. For example, to add extension function which is to be refered from script as "MyFunction" you have to implement and add it to engine:
void MyFunction_func(int nargs, variable* pargs, variable& result)
{
  // nargs is number of arguments that function receives
  // pargs is a pointer to an array of arguments
  // result is the variable to store function result

  // do what you need and pass result to result
}

....

// add it to engine:
// "MyFunction" is the way it will be used in script
// MyFunction_func is the implementation abow
// 1 is a legal number of arguments
::bee_add_extension_function("MyFunction", MyFunction_func, 1);

Once you have performed the abow steps, you can write in script:

print "MyFunction = ", MyFunction(1)
Engine will check syntax and report errors if any. At runtime engine will call your implementation function, pass it arguments and receive result. Isn't it easy?

Extension constants and objects (like a = Sheet(1).Cell(1, 1)) are added in similar way. Detailed documentation comes with source.

I tried to keep BeeBasic as close to standard basic as possible. It supports the following statements:

  • DIM ... AS ...
  • IF ... THEN ... ELSE ... END IF (single-line & multy-line)
  • FOR ... TO ... STEP ... NEXT
  • DO ... LOOP
  • WHILE ... WEND
  • GOTO
  • SUB ... END SUB
  • END
  • PRINT
  • INPUT
  • DIALOG (input values in dialog window)
  • BEEP
BeeBasic supports three variable types : string, integer and floating. BeeBasic contains common math and string-manipulation functions. I didn't try to add as many functions as possible, beacuse every developer can add ANY number of ANY function he needs.

Downloads

Download : source, documentation, samples - 281Kb
Visit homepage


Comments

  • It looks like the developers don't know about their competitors

    Posted by Legacy on 03/14/2002 12:00am

    Originally posted by: VBS Fan

    What a shame

    Reply
  • use this link ->

    Posted by Legacy on 03/13/2002 12:00am

    Originally posted by: liaisons

    http://www.paco.net/~bee_basic/beebasic_free.zip

    Reply
  • Excellent concept

    Posted by Legacy on 03/12/2002 12:00am

    Originally posted by: Philippe

    I haven't tried it yet, but the concept is excellent (small footprint, simple, extensible, apparently portable)

    Reply
  • I can't download it. File is not exgist.

    Posted by Legacy on 03/11/2002 12:00am

    Originally posted by: ^^*

    I can't download it. File is not exgist.

    Reply
  • I can't download it. File is not exgist.

    Posted by Legacy on 03/11/2002 12:00am

    Originally posted by: ^^*

    I can't download it. File is not exgist.

    Reply
  • I can't download it. File is not exgist.

    Posted by Legacy on 03/11/2002 12:00am

    Originally posted by: ^^*

    I can't download it. File is not exgist.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • CentreCorp is a fully integrated and diversified property management and real estate service company, specializing in the "shopping center" segment, and is one of the premier retail service providers in North America. Company executives travel a great deal, carrying a number of traveling laptops with critical current business data, and no easy way to back up to the network outside the office. Read this case study to learn how CentreCorp implemented a suite of business continuity services that included …

Most Popular Programming Stories

More for Developers

RSS Feeds