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

  • Mobile is introducing sweeping changes throughout your workplace. As a senior stakeholder driving mobile initiatives in your organization, you may be lost in a sea of technologies and claims from vendors promising rapid delivery of applications to your employees, customers, and partners. To help explain some of the topics you will need to be aware of, and to separate the must-haves from the nice-to-haves, this reference guide can help you with applying a mobile strategy in the context of application …

  • Hybrid cloud platforms need to think in terms of sweet spots when it comes to application platform interface (API) integration. Cloud Velocity has taken a unique approach to tight integration with the API sweet spot; enough to support the agility of physical and virtual apps, including multi-tier environments and databases, while reducing capital and operating costs. Read this case study to learn how a global-level Fortune 1000 company was able to deploy an entire 6+ TB Oracle eCommerce stack in Amazon Web …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds