\begin{syntax}
  term ::= integer                ; integer constant
       | real 			  ; real constant
       | lqualid 		  ; symbol
       | prefix-op term 	  ;
       | bang-op term 	  ;
       | term infix-op term 	  ;
       | term "[" term "]"	  ; brackets
       | term "[" term "<-" term "]" 	  ; ternary brackets
       | lqualid term+ 		  ; function application
       | "if" formula "then" term ;
         "else" term              ; conditional
       | "let" pattern "=" term "in" term
                                  ; local binding
       | "match" term ("," term)* "with" ;
         ("|" term-case)+ "end"          ; pattern matching
       | "(" term ("," term)+ ")" ; tuple
       | "{" term-field+ "}"     ; record
       | term "." lqualid         ; field access
       | "{" term "with" term-field+ "}"      ; field update
       | term ":" type 	          ; cast
       | label term 	      	  ; label
       | "'" uident    	      	  ; code mark
       | "(" term ")" 	      	  ; parentheses
  \
  pattern ::= pattern "|" pattern ; or pattern
            | pattern "," pattern ; tuple
	    | "_"                 ; catch-all
	    | lident              ; variable
	    | uident pattern*     ; constructor
	    | "(" pattern ")" 	  ; parentheses
	    | pattern "as" lident ; binding
  \
  term-case ::= pattern "->" term ;
  \
  term-field ::= lqualid "=" term ";"
\end{syntax}
