DIPARTIMENTO   DI   INFORMATICA
Università di Torino

Rank 2 Intersection Types and Polymorphic Recursion for (a subset of) Caml

Accepted syntax

program ::= type-definition;; program
| declaration;; program
| expr;;
     
type-definition ::= typeconstr-name = type-representation
| 'ident typeconstr-name = type-representation
| ( 'ident {, 'ident }+ ) typeconstr-name = type-representation
type-representation ::= constr-decl {| constr-decl }*
constr-decl ::= cconstr-name
| ncconstr-name of typexpr
     
typexpr ::= int | bool | unit | 'ident |
| typexpr -> typexpr | ( typexpr {* typexpr }+ )
| typeconstr-name | typexpr typeconstr-name
| ( typexpr {, typexpr }+ ) typeconstr-name
     
declaration ::= let let-binding
| let rec let-binding
     
let-binding ::= {value-name}+ = expr
     
expr ::= value-name | constant
| cconstr-name | ncconstr-name expr
| ( expr {, expr }+ ) | expr expr
| if expr then expr else expr
| match expr with pattern-matching
| fun {value-name}+ -> expr
| function pattern-matching
| let let-binding in expression
| let rec let-binding in expr
| expr infix-op expr | prefix-symbol expr
| expr :: expr
     
pattern-matching ::= pattern -> expr {| pattern -> expr }+
pattern ::= _ | value-name | constant
| cconstr-name | ncconstr-name pattern
| ( pattern {, pattern }+ )
| pattern :: pattern
     
infix-op ::= + | - | * | /
| > | < | = | <>
| && | ||
prefix-symbol ::= not | hd | tl | null | fst | snd
constant ::= ... | -1 | 0 | 1 | ...
| true | false | ()
     


[Back]

Comments to: damiani[at]di[dot]unito[dot]it