COMPEL is a command based interpreter. It was originally created to allow automation of certain tasks and at the same time to be able to add scripting facilities to high level programs. COMPEL later grew beyond its original purpose and was presented as my senior project for my CSI certification.
A command or statement in COMPEL always starts with a command or verb, such
as:
COMMAND arg1 arg2 [argN....]
echo "Hello world from COMPEL!\n"Another script to take a name and display a greeting messages:
var $name echo "Please type your name:" inputline $name echo "Welcome " $name "\n"A simple FOR loop:
echo "Hello world from COMPEL!\n"Another script to take a name and display a greeting messages:
var $i
for $i 1 to 10
{
echo "i=" $i "\n"
}
A script that shows how to create a user command:
delayecho "Hello world!\n" 2000
end
command delayecho $msg $delay
{
echo $fargs.msg
delay $fargs.delay
}
A script that types a string with delay of 100ms between each character:
command slowecho $msg $speed
{
var $i
var $s
tokenize $tok $fargs.msg
for $i 1 to $tok.count
{
echo $tok.$i
delay $fargs.speed
}
}
slowecho "Hello world\n" 100
end
Here's a screenshot of the debugger in action:
The IDE can load/Save workspaces for open project (breakpoints, watched variables, and window displacements). Whereas it cannot edit two project files at the same time.
compel 0.2.1 (Jan 16 2007 09:50:44) - console basic usage: ------------ ccompel script.compel general usage: -------------- ccompel [script.compel] [switch [switch param]] switches: --------- -rawfile [fn] : saves the script file after being processed internally -memleaks [fn] : generates memory leaks in the interpreter -args "arg1 arg2 ... argN" : arguments to be passed to the script -dumpsymtbl [fn] : dumps the symbol table upon script termination -i [prompt] : run script file, if passed, then start prompting for commands -fullns : register commands with their full namespace naming -cwd : changes the current directory to the one specified -dbgoutscript : debug outs the script lines and internal processing -shell : enable shell commands supportAn example of running a script with command line arguments would be:
ccompel myscript.compel -args "arg1 arg2 arg3"Then a script would access the parameters as:
/*
COMPEL passed argments tests
run with -args "1 2 3 4 5" or anything like that to pass arguments
*/
var $i 0
sub $args.count 1
for $i 0 to $args.count
{
echo "@[" $i "]=" $args.$i "\n"
}