COMPEL: Command based Interpreter and Developer library

What is COMPEL

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....]

Who can use COMPEL


COMPEL can be used equally by end-user/scripters and by developpers when they make use of compel_lib.dll and add scripting abilities to your high-level applications.
COMPEL comes with the following components:
COMPEL can also be used by instructors who want to teach their students the basics of programming using a simple and easy to learn fully equipped tool: COMPEL language and IDE

"Hello world" in COMPEL


Let us see how to write a simple script:
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

COMPEL IDE

COMPEL IDE is a simple editor with script debugging facilities:

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 command line interpreter

COMPEL ships with a "ccompel.exe" utility that allows you to run a script through the console.
This utility may be associated with "open" action of ".compel" scripts, it is equivalent to "cscript.exe" tool for VB/JScripts.
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 support
An 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"
}

Documentation

Due to the lack of time, COMPEL is partly documentend through its architecture document/appendix, and the variety of samples.
Please refer to the download section for more information.

Downloads