Cuneiform Syntax

This section gives a formal definition of the Cuneiform syntax. The entry point of a Cuneiform program is the Script (script).

All syntax diagrams have been generated using the Railroad Diagram Generator.

Complete Cuneiform syntax in EBNF:

script       ::= stat*

stat         ::= query
               | assign
               | defun

query        ::= compoundexpr ';'

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

sign         ::= '(' param+ ':' inparam* ')'

inparam      ::= param
               | '[' name+ ']'

param        ::= name
               | '<' name '>'

name         ::= ID( '(' 'String' ')' | '(' 'File' ')' )?

assign       ::= ID+ '=' compoundexpr ';'

lang         ::= 'bash' | 'lisp' | 'matlab' | 'octave' | 'perl' | 'python'
               | 'r' | 'java' | 'scala'

compoundexpr ::= 'nil'
               | expr+

expr         ::= ID
               | INTLIT
               | '"' STRLIT '"'
               | cnd
               | app

cnd          ::= 'if' compoundexpr 'then' compoundexpr 'else' compoundexpr 'end'

app          ::= ID '(' ( binding ( ',' binding )* )? ')'

binding      ::= ID ':' compoundexpr