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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • Live Event Date: October 29, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this eSeminar, Gene Kim will discuss these survey findings and will share woeful tales of artifact management gone wrong! Gene will also share examples of how …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds