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:
2 plus 5 equals 7
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
Press ENTER to continue...
Math demo
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
Click **here**
A JavaScript REPL for Android Devices
A Review of Kevin Mitnick's Book Ghost in the Wires
Play MP3 Files with Python on Windows
Internet Protocols and Rhino JavaScript
An SMTP Server Simulator in Perl
A Scrolling Banner using Canvas and JavaScript
Auto Save Images from the Clipboard
Choose your own Adventure with Sinatra
Preventing Windows Screen-Saver Activation
Why Some Web Sites will go Dark on Jan 18th
Book Review : Paull Allen - Idea Man
A 90's Experiment in Online Systems - The U.S. West CommunityLink Service