Menu
17 JavaScript tools breathing new life into old code

17 JavaScript tools breathing new life into old code

From Lisp to Pascal, old code is new again, thanks to these JavaScript cross-compilers, translators, and emulators

Computer languages have a strange shelf life. The most popular among them experience explosive growth driven by herding behavior akin to that of the fashion industry. But when they fade from the spotlight, something odd happens. Instead of disappearing like a pop song or parachute pants, they live on and on and on and on. The impetus behind this quasi-immortality? It's often cheaper to maintain old code than to rewrite it in the latest, trendiest language.

In the past, tending to an old code base was a lonely experience, not unlike living on a desert island. The job was to keep everything running with virtual duct tape and baling wire. Old tools and old compilers were coddled and fussed over because they were essential to keeping the old code alive. Old libraries were treated like family heirlooms, especially if they came with source code.

That's changed in recent years with the emergence of new cross-compilers and interpreters. Suddenly the old can be brought into the present, not with perfect harmony but with enough integration that curators don't need to feel like they're living and working alone. The right tools can follow Ezra Pound's dictum to "make it new again."

Thanks to the ingenuity of an intrepid few, old code is receiving new life via a variety of JavaScript tools. Now, that brittle base can become part of the present, capable of running on modern machines. Suddenly the dusty deck that ran on only a mainframe can operate in the background whenever someone loads a Web page on their phone.

The tools are far from perfect, but they tantalize despite their flaws. Rewriting remains a challenge, as it usually means understanding code that was written when disk space was expensive and comments cost real money. While putting in the effort can yield great benefits and erase some technical debt, we often don't have that luxury. Instead, it might be simpler and faster to fiddle with these cross-compilers, translators, and emulators to modernize old code bases than it would be to collect a big team steeped in dying programming languages to pick through old code and rewrite everything.

Here is a look at some of the obscure programming languages that can be given new life, thanks to emerging JavaScript tools. Conversion tools like these may be the only way to keep some of these now obscure languages alive. Consider them a life-support system for your old code.

Pascal

Was it 20-odd years ago that TurboPascal ruled the desktop programming world? The folks at Elevate Software remember, and that's why they offer a tool that converts ObjectPascal into JavaScript. They even promise that you won't need to learn Pascal to produce something that runs on the Web. You simply type Pascal, and the tool comes back with code that looks and operates in the same way on all major browsers.

Cobol

The language that dominated the mainframe world and still commands 553 jobs on Dice.com at this writing can also run in the world of JavaScript. CobolScript is a Node.js package that will run many parts of standard Cobol alongside JavaScript code written for the Node.js server.

The developer calls it a work in progress and lists a number of parts that don't function yet, but there are enough juicy examples to show promise, like the ability to enable dusty Cobol code to suck data from MySQL and spit out HTML to power a modern Web app.

Lisp

For many people who learned to program from reading Hal Ableson and Gerry Sussman's "Structure and Interpretation of Computer Programs," there's no better way to spend an afternoon than counting parentheses and making sure they balance. Lisp and its various dialects continue to hold a special place in the hearts of those who learned them early, and many of their structural ideas are now part of the foundations of a number of modern languages, including JavaScript. The syntax may be gone, but the flexible architecture remains.

There are more than a dozen options for enlivening your Lisp code via JavaScript, and they vary in approach from the traditional to the experimental. EdgeLisp, for instance, offers many of Lisp's standard constructs, and its development team promises that EdgeLisp will "feel familiar to Common Lisp programmers." Parenscript offers "the full power of Lisp macros" and much more from the world of Common Lisp. If you like the Lisp-1 dialect, then Ralph is another option.

Fans of Scheme will find a number of implementations like BiwaScript, Moby Scheme, and nconc.

There are also plenty of more experimental syntaxes that promise all of the fun of thinking in Lisp with a slightly different format. LispyScript mixes in some of the power of macros with parentheses. Oppo is an option that introduces itself with the following claim: "If JavaScript is Lisp in C's clothing, then Oppo is Lisp in Lisp's clothing, with C's pajamas."

Smalltalk

While it's common knowledge that Apple and Microsoft borrowed heavily from the ideas circulating at Xerox PARC, it is often forgotten that the Xerox PARC researchers also revolutionized programming languages. When most programmers were fussing with GOTOs and subroutines, Smalltalk was one of the first languages to bring object-oriented options to the world.

Clamato, for instance, converts many of the easy Smalltalk constructs into the parts of JavaScript that are similar (and ultimately stolen). Not everything is there, but the developers behind Clamato throw in a connection to jQuery and other DOM manipulation tools to make up for it, so you can build Web apps.

Little Smallscript also offers a subset that will compile down to JavaScript and run on Node.js. Those who have moved on to the more modern Squeak can use a JavaScript version called SqueakJS.

Logo

Before there were full IDEs to teach kids to code with languages like Scratch and Alice, there was Logo. There's still Logo today if you want to use Logo Interpreter in your browser and have all of the fun of its stripped-down syntax built when bandwidth was measured in baud and every keystroke counted. It has a simple elegance that can't be matched with all of the modern tile-dragging and button-clicking.

Basic

The '70s never died. Not only can you emulate your old Commodore 64 games on the Web, but you can keep that 1970s Basic code running too. Well, that may be a bit of an exaggeration because there have been so many dialects over the years. But you can still create something new and current with all of the simplicity that made Basic popular.

If you liked QBasic, the structured language that Microsoft made famous, then you can start with qb.js, a JavaScript implementation that will run in your browser. Once it starts running, it turns a Canvas object in your browser into a rectangle filled with old, monospaced type. It becomes a window into another era. Not all of the parts seem to work smoothly, but the code is open, so you can revise and extend it under the GPL 3.0.

NSBasic is a more commercial option that produces code for JavaScript environments that run on desktops and mobile devices. NSBasic targets developers who don't want to struggle with the complexity of Eclipse or XCode to produce something for their smartphones. You can turn your old Basic experience into an entry for the App Store.

Another commercial option is SpiderBasic, a modern version said to be built in the tradition of PureBasic. It offers access to all of the HTML5 and WebGL hooks necessary for building a modern, multiwindow Web app.

Join the CIO Australia group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags software(no company)

More about AppleDiceEclipseMicrosoftMySQLOppoXerox

Show Comments
[]