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

  • Bonita BPM 7 is here! And for you, an in-depth tour of its innovation. In this webinar, we'll guide you through the brand-new features of this release and demonstrate them live. You will: Discover how business application implementation and maintenance is now even easier, with decoupling of process logic, business data and user interface Learn how to create "living applications" for business processes which present business data in custom views We recommend that you watch the half-hour recording of our …

  • Thanks to wide spread cloud hosting and innovations small businesses can meet and exceed the legacy systems of goliath corporations. Explore the freedom to work how you want, with a phone system that will adapt to your evolving needs and actually save you lots of expense—read Get an Enterprise Phone System without High Cost and Complexity. The article clearly illustrates: The only hardware you'll need is phone equipment for advanced voice and fax. How to join all your employees, mobile devices, …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date