Language Specification - filter =============================== Context-free Syntax =================== BASE ---- filter ::= { dataDef } ; dataDef ::= "data" IDENT "{" { component } "}" ; component ::= data IDENT ";" | "val" "=" expr ";" | "str" "=" expr ";" | "check" expr ";" ; data ::= IDENT | "bit" | data "[" expr "]" | data "|" data ; expr ::= INTLIT | STRINGLIT | IDENT | expr "[" expr "]" | expr "+" expr | expr "-" expr | expr "*" expr | expr "/" expr | expr "^" expr | expr "&&" expr | expr "||" expr | expr "<" expr | expr "<=" expr | expr ">" expr | expr ">=" expr | expr "==" expr | expr "!=" expr | expr "++" expr | "-" expr | "format" "(" STRINGLIT "," expr ")" | "val" | "(" expr ")" ; STD --- dataDef ::= ... | "data" IDENT "=" data ";" ; expr ::= ... | "if" expr "then" expr "else" expr | "foldval" "(" expr "," expr ")" | "foldstr" "(" expr "," expr ")" ; EXT --- component ::= ... | datadef ; expr ::= ... | "fold" "(" expr "," expr ")" | expr "[" expr ".." expr "]" ; Precedence of operators ----------------------- The operators, ordered from lowest priority to highest priority. if-then-else | .. &&, || ++ <,<=,>,>=,==,!= +,- *,/ ^ [] Lexical Syntax ============== BASE ---- STRING = starts with " and ends with ", does not contain " or \ or newlines. Additionally "\n" is a string. INTEGER = a non empty sequence of the decimal digits 0 to 9 IDENT = a letter followed by a non empty sequence of letters or digits (only ascii). Also, all quoted tokens from the context-free grammar like "data" or "+" are tokens. White space contains space, tab, newline and return (" ", \t, \n and \r). There are no comments. STD --- STRING = additionally strings may contain the escape sequences "\n", "\t", "\"" and "\\" LINECOMMENT = starts with //, ends at the end of the line. EXT --- LONGCOMMENT = starts with /*, ends at the next */