Informal grammar

Below is just a sketch of the TethysL grammar. (The actual parser definition is captured here.)

topLevel ::= missionType | aggregateType

missionType ::=
    "mission" identifier "{"
      description?
      defineArgs?
      defineOutput?
      endRunGroup?
      maTypeChoice*
    "}"

aggregateType ::=
    "aggregate" identifier "{"
      description? 
      defineArgs? 
      defineOutput? 
      runInGroup
      endRunGroup? 
      preemptive? 
      maTypeChoice*
    "}"

description ::= """...any text...""" | '''...any text...'''

defineArgs    ::= "arguments" "{" defineArg* "}"
defineOutput  ::= "output" "{" defineArg* "}"

defineArg     ::= identifier "=" expression 

endRunGroup   ::= ergBreak | ergTimeout

ergBreak      ::= "break" "{" description? expression "}"
ergTimeout    ::= "timeout" duration
duration      ::= "duration" "=" string

identifier    ::= (letter | "_") (letter | digit | "_" | ".")*

expression    ::= orExpression
orExpression  ::= andExpression    ( orOp  andExpression    )*
andExpression ::= relExpression    ( andOp relExpression    )*
relExpression ::= addSubExpression ( relOp addSubExpression )*
addExpression ::= divMulExpression ( asOp  divMulExpression )*

orOp  ::= "or"  | "||"
andOp ::= "and" | "&&"
relOp ::= "<"   | "<=" | ">" | ">=" | "==" | "!="
asOp  ::= "+"   | "-"

Notation:

  • | separates alternative forms for the rule. For example, the rule for topLevel indicates that a script file can define either a mission or an aggregate.
  • ? means the element is optional
  • * means the element can appear zero or more times
  • + means the element can appear one or more times
  • Strings in double quotes are to be used literally
  • Triple quotes (used in description) are also to be used literally