Originally published on: Tue, 12 May 2009 01:39:26 +0000
In the latter part of the year 2000, I decided to write a commercial programming language interpreter called BPL - Batch Programming Language.
I had envisioned a language that would employ a simple syntax similar to the syntax used by MS-DOS/Windows batch file scripts.
This language would employ no expressions nor true user-defined functions; each line of code would simply contain a command and a list of arguments that could be coupled with that command. Often, a variable name ( without the $ prefix ) was required as the first parameter so that a value computed by the given command could directly be stored in the specified variable.
Consider this sample BPL program
math.bpl
The output of the above program is:
Math demo
2 plus 5 equals 7
Press ENTER to continue...
2 minus 5 equals -3
2 times 5 equals 10
2 divided by 5 equals 0
The remainder of 2 divided by 5 is 2
2 and 5 is 0
2 or 5 is 7
2 exclusive-or 5 is 7
Note that like batch files and TCL, ( Tool Command Language ) the variable names do not have a $ prefix if they are a target of an assignment. The only time a variable name has a $ prefix is if the variable represents a value and is to be expanded to said value.
While BPL did entertain a modest success, the product was not popular enough for me to continue work on the BPL compiler that I had begun to write. If you study the BPL source, you'll see that I made a number of design flaws that would have made supporting the initial syntax with a compiler clumsy at best.
The EXTGOSUB and EXTRETURN verbs allowed one BPL script to invoke a subroutine in another. I should have added some sort of IMPORT or MODULE or REQUIRE verb so that the primary script would have to define all modules that it intends to leverage with EXTGOSUB. That alone would have ensured that a BPL compiler could have recursively derived the names of all subordinate files to ensure that all were captured in the compilation process.
Like the venerable COMMAND.COM, BPL keeps the script files open while executing. I had begun to implement a caching mechanism that would load each file into a block of memory and would keep it there, but in the interpreter flavor of BPL this would have prevented someone from building a script dynamically and then invoking it with an EXTGOSUB.
Other things I would change:
I had implemented a WHILE/WEND combination so that I could avoid using the GOTO ( why did I put GOTO in the language? ), but I've since lost the source to that implementation.
As I released BPL, I was aware of commercial utilities like WinBatch, but new contenders were making names for themselves. AutoIt and AutoHotKey arrived on the scene, sporting more popular syntaxes and very impressive community support.
I retired BPL a few years ago and have recently decided to release the interpreter source and documentation as open source.
The source code, EXE, sample scripts, and HTML documentation for BPL can be found here.
http://www.mailsend-online.com/wp/bpl.zip
Unless otherwise noted, all code and text entries are Copyright ©2009 by James K. Lawless.
Views expressed in this blog are those of the author and do not necessary reflect those of the author's employer. Views expressed in the comments are those of the responding individual.

Save to StumbleUpon
Digg it
Save to Reddit
Share on Facebook
Share on Twitter
More bookmarks
Compiling C from the Command Line with Pelles C
A Forthcoming Marvel Movie Villain
Uninstalling Problematic Windows Software
A JavaScript REPL for Android Devices
Preventing Windows Screen-Saver Activation
Twimmando: A Command-line Twitter Client
Embedding JavaScript in a Batch File
Scrolling GIF Banners with PerlMagick
Thwarting HTTP Referer Trackbacks
My First C64 Interrupt Program
Playing with OS/X Text to Speech
The Villain at the end of Marvel's Avengers Move is...
Processing GMail items with Ruby
Happy 30th Birthday, Commodore 64
MailWrench CSharp Command Line Mailer for Windows is now Free Software
Rainy Day Fun with the HTML DOM
Building a World War II Foxhole Radio
Prototerp – Unleashing a JavaScript REPL via the Mobile Browser