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

  • Ever-increasing workloads and the challenge of containing costs leave companies conflicted by the need for increased processing capacity while limiting physical expansion. Migration to HP's new generation of increased-density rack-and-blade servers can address growing demands for compute capacity while reducing costly sprawl. Sponsored by: HP and Intel® Xeon® processors Intel, the Intel logo, and Xeon Inside are trademarks of Intel Corporation in the U.S. and/or other countries. HP is the sponsor …

  • You probably have several goals for your patient portal of choice. Is "community" one of them? With a bevy of vendors offering portal solutions, it can be challenging for a hospital to know where to start. Fortunately, YourCareCommunity helps ease the decision-making process. Read this white paper to learn more. "3 Ways Clinicians can Leverage a Patient Portal to Craft a Healthcare Community" is a published document owned by www.medhost.com

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds