www.BrettDaniel.com

Untitled

I'm doing something really, really cool at work right now. While I can't really give any specifics on what it will be used for, I'm reasonably certain that I can post a 30,000-foot overview.

The basic idea is that I have pretty much written a scripting language using PHP (which, ironically, is considered a scripting language itself) to act as a frontend for a very simple and user-friendly data retrieval system. The beauty of this "language" is its simplicity. It of course evaluates mathematical expressions like any other language, but the main work is done by just five simple built-in "functions" that get and process sets of data. I'm going to add one or two more to perform tests on the data, but so far I've just been trying to get the basic syntax banged out.

The amazing part, and the part that impresses even me, is the fact that the language does everything it needs to using just a whole bunch of regular expressions. Basically the regular expressions match a language construct and replace it with whatever it evaluates to. Because of this, the entire "language parser" is contained in just a single PHP page with about eight functions, five of which map almost one-to-one to the language's built-in functions. Again, I'm glossing over many of the particulars like the language syntax, how I validate the script, and how it processes the various kinds of function arguments— needless to say, I don't just use eval($script);!

I've been working on the language for only about three days now, but already it's fast, elegant, and functional; you can't ask for much more than that.

No Comments

Comments are closed.