Task Definition (defun)

A Task Definition (defun) defines a task with an ID and a Task Signature (sign). A task can be native, in which case it has a native body consisting of one or more elements of the form of an Assignment (assign). Furthermore, a task can be foreign, in which case it has a Language Id (lang) and a foreign BODY enclosed in mickey mouse-eared curly braces.

A Statement (stat) can be a Task Definition.


defun ::= 'deftask' ID sign( '{' assign+ '}' | 'in' lang '*{' BODY '}*' )


An ID is a regular string beginning with a letter and containing letters, numbers, or the symbols -, _, or . and not being a keyword.
The BODY is a regular string not containing the symbols } and * in a row.


The identity task defined natively:

deftask identity( out : inp ) {
  out = inp;

A greet task with a foreign body in the language Bash:

deftask greet( out : person )in bash *{
  out="Hello $person"

A task in R adding pairs of numbers:

deftask addpair( c : a b )in r *{
  c = a+b

A task definition in Bash extracting a tar archive:

deftask untar( <out( File )> : tar( File ) )in bash *{
  tar xf $tar
  out=`tar tf $tar`

A task in Bash gunzipping a compressed file:

deftask gunzip( out( File ) : gz( File ) )in bash *{
  gzip -c -d $gz > $out

A task in Bash concatenating a list of files:

deftask cat( out( File ) : <file( File )> )in bash *{
  cat ${file[@]} > $out