  Checktestdata language specification
  by the DOMjudge team



  11..  CChheecckktteessttddaattaa llaanngguuaaggee ssppeecciiffiiccaattiioonn

  This specification is dedicated to the public domain. Its authors
  waive all rights to the work worldwide under copyright law, including
  all related and neighboring rights, as specified in the Creative
  Commons Public Domain Dedication (CC0 1.0)
  <http://creativecommons.org/publicdomain/zero/1.0/>.

  Grammar and command syntax below. A valid checktestdata program
  consists of a list of commands. All commands are uppercase, while
  variables are lowercase with non-leading digits. Lines starting with
  '#' are comments and ignored.

  The following grammar sub-elements are defined:

  ______________________________________________________________________
  integer := 0|-?[1-9][0-9]*
  float := -?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?
  string := ".*"
  variable := [a-z][a-z0-9]*
  value := <integer> | <float> | <variable>
  compare := '<' | '>' | '<=' | '>=' | '==' | '!='
  expr := <term> | <expr> [+-] <term>
  term := <term> [*%/] <factor> | <factor>
  factor := <value> | '-' <term> | '(' <expr> ')' | <factor> '^' <factor>
  test := '!' <test> | '(' <test> ')' | <test> [&|] <test> |
   <expr> <compare> <expr> | 'MATCH(' <string> str ')' | 'ISEOF'
  ______________________________________________________________________



  That is, integer, as well as floating point values (of arbitrary size
  and precision) are supported, as well as operators +-*%/^ with the
  usual rules of precedence. An expression is integer if all its sub-
  expressions are integer. Integer division is used on integers.  The
  exponentiation operator ^ only allows non-negative integer exponents
  that fit in an unsigned long.

  MATCH and ISEOF are special keywords that return whether the next
  character matches any of 'str', respectively if end-of-file has been
  reached.

  Within a string, the backslash acts as escape character for the
  following expressions:

  +o  \[0-7]{1,3} denotes an octal escape for a character

  +o  \n, \t, \r, \b denote linefeed, tab, carriage return and backspace

  +o  \" and \\ denote " and \

  +o  an escaped newline is ignored (line continuation)

     A backslash preceding any other character is treated as a literal
     backslash.

  The following commands are available:

     SPACE / NEWLINE
        No-argument commands matching a single space (0x20) or newline
        respectively.

     EOF
        Matches end-of-file. This is implicitly added at the end of each
        program and must match exactly: no extra data may be present.

     INT(<expr> min, <expr> max [, <variable> name])
        Match an arbitrary sized integer value in the interval [min,max]
        and optionally assign the value read to variable 'name'.

     FLOAT(<expr> min, <expr> max [, <variable> name [, option]])
        Match a floating point number in the range [min,max] and
        optionally assign the value read to the variable 'name'. When
        the option 'FIXED' or 'SCIENTIFIC' is set, only accept floating
        point numbers in fixed point or scientific notation,
        respectively.

     STRING(<string> str)
        Match the literal string 'str'.

     REGEX(<string> str)
        Match the extended regular expression 'str'. Matching is
        performed greedily.

     REP(<expr> count [,<command> separator]) [<command>...] END
        Repeat the commands between the 'REP() ... END' statements count
        times and optionally match 'separator' command (count-1) times
        in between. The value of count must fit in an unsigned 32 bit
        int.

     WHILE(<test> condition [,<command> separator]) [<command>...] END
        Repeat the commands as long as 'condition' is true. Optionally
        match 'separator' command between two consecutive iterations.

     IF(<test> cond) [<command> cmds1...] [ELSE [<command> cmds2...]]
        END
        Executes cmds1 if cond is true. Otherwise, executes cmds2 if the
        else statement is available.



