Kjetil's Information Center: A Blog About My Projects

Attoscript

Attoscript is a very small programming language and interpreter (only 15K of source) that I designed myself. It is severely limited in many ways, but is intended for one task; running other programs.

Since the names microscript, nanoscript etc. are taken, I choose attoscript as the name for the language. "Atto" is the SI-prefix for Quintillionth/Trillionth.

The reason I actually created this language, was to have an alternative to batch files.
These are some of the improvements in the language over batch:
* Sleep instruction, to halt execution. (Ping trick anyone?)
* Creating random numbers.
* Reading user input into variables. (No hacks like generating and reading other batch files needed.)
* IF-construct that makes sense. (No strange "errorlevel" stuff.)

Here is a sample of what the language looks like:

var count
set count 10
label loop
echo "There are $count$ bottles of prune juice on the wall."
decr count
if count ne 0 loop
          


The interpreter is written in C, and the source can be downloaded here. (Licenced under GNU GPL version 2.)
I have also created a windows binary that can be downloaded here. (Compiled with Dev-C++.)

More information about the scripting language can be found in the README file in the source tarball.

Topic: Open Source, by Kjetil @ 19/08-2007, Article Link