Link Search Menu Expand Document
\( % cbs-katex.sty % \newcommand{\STYLE}[2]{\htmlClass{cbs-#1}{#2}} \newcommand{\DECL}[3]{\htmlId{#1:#2}{#3}} \newcommand{\REF}[3]{\href{###1:#2}{#3}} \newcommand{\HYPER}[5]{\href{#1/#2/index.html###3:#4}{#5}} % \SHADE{MATH} can be defined to produce a shaded background to highlight % inline MATH in running text: \newcommand{\SHADE}[1]{#1} % \KEY{TEXT}, \STRING{TEXT}, \ATOM{TEXT}, \LEX{TEXT} can be used in math mode: \newcommand{\KEY}[1]{\textsf{\textit{\STYLE{Key}{#1}}}} \newcommand{\STRING}[1]{\textsf{``\texttt{#1}''}} \newcommand{\ATOM}[1]{\textsf{`\texttt{#1}'}} \newcommand{\LEX}[1]{\textsf{\STYLE{Key}{`}\texttt{#1}\STYLE{Key}{'}}} % The following commands produce ASCII characters that are treated specially by LaTeX: \newcommand{\HASH}{\char`\#} \newcommand{\DOLLAR}{\char`\$} \newcommand{\PERCENT}{\char`\%} \newcommand{\AMPERSAND}{\char`\&} \newcommand{\APOSTROPHE}{\char`\'} \newcommand{\BACKSLASH}{\char`\\} \newcommand{\CARET}{\char`\^} \newcommand{\UNDERSCORE}{\char`\_} \newcommand{\GRAVE}{\char`\`} \newcommand{\LEFTBRACE}{\char`\{} \newcommand{\RIGHTBRACE}{\char`\}} \newcommand{\TILDE}{\textasciitilde} % {\char`\~} % \NAME{name} highlights the name; % \NAMEDECL{name} declares Name.name as the target of links to name; % \NAMEREF{name} links name to the target Name.name in the current file; % \NAMEHYPER{url}{file}{name} links name to Name.name at url/file/file.pdf. % Similarly for \VAR{partvariable}, \SYN{syntaxname}, \SEM{semanticsName}, % and \SECT{sectionnumber} % The kerns in \SUB and \VAR avoid overlaps with primes: \newcommand{\SUB}[1]{_{\kern-2mu\STYLE{PartVariable}{\textsf{#1}}}} % PLAIN \newcommand{\VAR}[1]{\STYLE{PartVariable}{\textsf{\textit{#1}\kern2mu}}} \newcommand{\NAME}[1]{\STYLE{Name}{\textsf{#1}}} \newcommand{\SYN}[1]{\STYLE{SyntaxName}{\textsf{#1}}} \newcommand{\SEM}[1]{\STYLE{SemanticsName}{\textsf{#1}}} \newcommand{\SECT}[1]{\STYLE{SectionNumber}{\textsf{#1}}} % DECL \newcommand{\VARDECL}[1]{\DECL{PartVariable}{#1}{\VAR{#1}}} \newcommand{\NAMEDECL}[1]{\DECL{Name}{#1}{\NAME{#1}}} \newcommand{\SYNDECL}[1]{\DECL{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMDECL}[1]{\DECL{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTDECL}[1]{\DECL{SectionNumber}{#1}{\textsf{#1}}} % REF \newcommand{\VARREF}[1]{\REF{PartVariable}{#1}{\VAR{#1}}} \newcommand{\NAMEREF}[1]{\REF{Name}{#1}{\NAME{#1}}} \newcommand{\SYNREF}[1]{\REF{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMREF}[1]{\REF{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTREF}[1]{\REF{SectionNumber}{#1}{\SECT{#1}}} % HYPER \newcommand{\VARHYPER}[3]{\HYPER{#1}{#2}{PartVariable}{#3}{\VAR{#3}}} \newcommand{\NAMEHYPER}[3]{\HYPER{#1}{#2}{Name}{#3}{\NAME{#3}}} \newcommand{\SYNHYPER}[3]{\HYPER{#1}{#2}{SyntaxName}{#3}{\SYN{#3}}} \newcommand{\SEMHYPER}[3]{\HYPER{#1}{#2}{SemanticsName}{#3}{\SEM{#3}}} \newcommand{\SECTHYPER}[3]{\HYPER{#1}{#2}{SectionNumber}{#3}{\SECT{#3}}} % \LEFTPHRASE MATH \RIGHTPHRASE produces [[ MATH ]] with proper brackets: \newcommand{\LEFTPHRASE}{\llbracket} \newcommand{\RIGHTPHRASE}{\rrbracket} % \LEFTGROUP MATH \RIGHTGROUP produces ( MATH ) where the parentheses are % highlighted the same as keywords: \newcommand{\LEFTGROUP}{\STYLE{Key}{(}} \newcommand{\RIGHTGROUP}{\STYLE{Key}{)}} % MATH\PLUS produces a superscript + % MATH\STAR produces a superscript * % MATH\QUERY produces a superscript ? \newcommand{\PLUS}{{}^{\texttt{+}}} \newcommand{\STAR}{{}^{\texttt{*}}} \newcommand{\QUERY}{{}^{\texttt{?}}} % \RULE{& PREMISE \\ & ...}{& FORMULA ... \\ & ...} produces an inference rule % with separately aligned premises and conclusion % PREMISE % ... % ----------- % FORMULA ... % ... \newcommand{\RULE}[2] {\frac{\begin{aligned}#1\end{aligned}}{\begin{aligned}#2\end{aligned}}} % \AXIOM{& FORMULA ... \\ & ...} produces an aligned formula % % FORMULA ... % ... \newcommand{\AXIOM}[1]{\begin{aligned}#1\end{aligned}} % \TO TYPE produces => TYPE \newcommand{\TO}{\mathop{\Rightarrow}} % TERM \TRANS TERM produces TERM ---> TERM \newcommand{\TRANS}{\longrightarrow} % TERM \xrightarrow{LABEL} TERM puts the label above the long arrow % \)

Languages-beta : OC-L-08-Type-and-Exception-Definitions.cbs | PLAIN | PDF

OUTLINE

\[\KEY{Language} \quad \STRING{OCaml Light}\]

\(\SECT{8}\) Type and exception definitions

\[\begin{align*} \KEY{Syntax} \quad \VARDECL{TDS} : \SYNDECL{type-definition} \ ::= \ & \ \LEX{type} \ \SYNREF{typedef} \ \SYNREF{and-typedef}\STAR \\ \VARDECL{ATD} : \SYNDECL{and-typedef} \ ::= \ & \ \LEX{and} \ \SYNREF{typedef} \\ \VARDECL{TD} : \SYNDECL{typedef} \ ::= \ & \ \SYNREF{type-params}\QUERY \ \SYNHYPER{../.}{OC-L-03-Names}{typeconstr-name} \ \SYNREF{type-information} \\ \VARDECL{TI} : \SYNDECL{type-information} \ ::= \ & \ \SYNREF{type-equation}\QUERY \ \SYNREF{type-representation}\QUERY \ \SYNREF{type-constraint}\STAR \\ \VARDECL{TE} : \SYNDECL{type-equation} \ ::= \ & \ \LEX{{=}} \ \SYNHYPER{../.}{OC-L-04-Type-Expressions}{typexpr} \\ \VARDECL{TR} : \SYNDECL{type-representation} \ ::= \ & \ \LEX{{=}} \ \LEX{{|}}\QUERY \ \SYNREF{constr-decl} \ \SYNREF{bar-constr-decl}\STAR \\ \ \mid \ & \ \LEX{{=}} \ \SYNREF{record-decl} \\ \VARDECL{BCD} : \SYNDECL{bar-constr-decl} \ ::= \ & \ \LEX{{|}} \ \SYNREF{constr-decl} \\ \VARDECL{TPS} : \SYNDECL{type-params} \ ::= \ & \ \SYNREF{type-param} \\ \ \mid \ & \ \LEX{{(}} \ \SYNREF{type-param} \ \LEFTGROUP \LEX{{,}} \ \SYNREF{type-param} \RIGHTGROUP\STAR \ \LEX{{)}} \\ \VARDECL{TP} : \SYNDECL{type-param} \ ::= \ & \ \SYNREF{variance}\QUERY \ \LEX{{\APOSTROPHE}} \ \SYNHYPER{../.}{OC-L-01-Lexical-Conventions}{ident} \\ \SYNDECL{variance} \ ::= \ & \ \LEX{{+}} \mid \LEX{{-}} \\ \VARDECL{RD} : \SYNDECL{record-decl} \ ::= \ & \ \LEX{{\LEFTBRACE}} \ \SYNREF{field-decl} \ \LEFTGROUP \LEX{{;}} \ \SYNREF{field-decl} \RIGHTGROUP\STAR \ \LEX{{;}}\QUERY \ \LEX{{\RIGHTBRACE}} \\ \VARDECL{CD} : \SYNDECL{constr-decl} \ ::= \ & \ \LEFTGROUP \SYNHYPER{../.}{OC-L-03-Names}{constr-name} \mid \LEX{{[}} \ \LEX{{]}} \mid \LEX{{(}{:}{:}{)}} \RIGHTGROUP \ \LEFTGROUP \LEX{of} \ \SYNREF{constr-args} \RIGHTGROUP\QUERY \\ \VARDECL{CA} : \SYNDECL{constr-args} \ ::= \ & \ \SYNHYPER{../.}{OC-L-04-Type-Expressions}{typexpr} \ \SYNHYPER{../.}{OC-L-04-Type-Expressions}{star-typexpr}\STAR \\ \VARDECL{FD} : \SYNDECL{field-decl} \ ::= \ & \ \SYNHYPER{../.}{OC-L-03-Names}{field-name} \ \LEX{{:}} \ \SYNHYPER{../.}{OC-L-04-Type-Expressions}{poly-typexpr} \\ \VARDECL{ED} : \SYNDECL{exception-definition} \ ::= \ & \ \LEX{exception} \ \SYNREF{constr-decl} \\ \ \mid \ & \ \LEX{exception} \ \SYNHYPER{../.}{OC-L-03-Names}{constr-name} \ \LEX{{=}} \ \SYNHYPER{../.}{OC-L-03-Names}{constr} \\ \VARDECL{TC} : \SYNDECL{type-constraint} \ ::= \ & \ \LEX{constraint} \ \LEX{{\APOSTROPHE}} \ \SYNHYPER{../.}{OC-L-01-Lexical-Conventions}{ident} \ \LEX{{=}} \ \SYNHYPER{../.}{OC-L-04-Type-Expressions}{typexpr} \end{align*}\]

Type definitions

\[\begin{align*} \KEY{Semantics} \quad & \SEMDECL{define-types} \LEFTPHRASE \ \_ : \SYNREF{type-definition} \ \RIGHTPHRASE : \TO \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Binding}{environments} \\ \KEY{Rule} \quad & \SEMREF{define-types} \LEFTPHRASE \ \LEX{type} \ \VARREF{TD} \ \VARREF{ATD}\STAR \ \RIGHTPHRASE = \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Binding}{collateral} ( \SEMREF{define-typedefs} \LEFTPHRASE \ \VAR{TD} \ \VAR{ATD}\STAR \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Semantics} \quad & \SEMDECL{define-typedefs} \LEFTPHRASE \ \_ : \LEFTGROUP \SYNREF{typedef} \ \SYNREF{and-typedef}\STAR \RIGHTGROUP \ \RIGHTPHRASE : ( \TO \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Binding}{environments} )\PLUS \\ \KEY{Rule} \quad & \SEMREF{define-typedefs} \LEFTPHRASE \ \VARREF{TD}\SUB{1} \ \LEX{and} \ \VARREF{TD}\SUB{2} \ \VARREF{ATD}\STAR \ \RIGHTPHRASE = \\&\quad \SEMREF{define-typedefs} \LEFTPHRASE \ \VAR{TD}\SUB{2} \ \RIGHTPHRASE , \SEMREF{define-typedefs} \LEFTPHRASE \ \VAR{TD}\SUB{2} \ \VAR{ATD}\STAR \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \SEMREF{define-typedefs} \LEFTPHRASE \ \VARREF{TPS}\QUERY \ \VARHYPER{../.}{OC-L-03-Names}{TCN} \ \LEX{{=}} \ \VARREF{CD} \ \VARREF{BCD}\STAR \ \RIGHTPHRASE = \\&\quad \SEMREF{define-constrs} \LEFTPHRASE \ \VAR{CD} \ \VAR{BCD}\STAR \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \SEMREF{define-typedefs} \LEFTPHRASE \ \VARREF{TPS}\QUERY \ \VARHYPER{../.}{OC-L-03-Names}{TCN} \ \LEX{{=}} \ \VARREF{RD} \ \RIGHTPHRASE = \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Maps}{map} ( \ ) \\ \KEY{Rule} \quad & \SEMREF{define-typedefs} \LEFTPHRASE \ \VARREF{TPS}\QUERY \ \VARHYPER{../.}{OC-L-03-Names}{TCN} \ \LEX{{=}} \ \VARHYPER{../.}{OC-L-04-Type-Expressions}{T} \ \RIGHTPHRASE = \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Maps}{map} ( \ ) \end{align*}\] \[\begin{align*} \KEY{Semantics} \quad & \SEMDECL{define-constrs} \LEFTPHRASE \ \_ : \LEFTGROUP \SYNREF{constr-decl} \ \SYNREF{bar-constr-decl}\STAR \RIGHTGROUP \ \RIGHTPHRASE : ( \TO \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Binding}{environments} )\PLUS \\ \KEY{Rule} \quad & \SEMREF{define-constrs} \LEFTPHRASE \ \VARREF{CD}\SUB{1} \ \LEX{{|}} \ \VARREF{CD}\SUB{2} \ \VARREF{BCD}\STAR \ \RIGHTPHRASE = \\&\quad \SEMREF{define-constrs} \LEFTPHRASE \ \VAR{CD}\SUB{1} \ \RIGHTPHRASE , \SEMREF{define-constrs} \LEFTPHRASE \ \VAR{CD}\SUB{2} \ \VAR{BCD}\STAR \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \SEMREF{define-constrs} \LEFTPHRASE \ \VARHYPER{../.}{OC-L-03-Names}{CN} \ \RIGHTPHRASE = \\&\quad \{ \SEMHYPER{../.}{OC-L-03-Names}{constr-name} \LEFTPHRASE \ \VAR{CN} \ \RIGHTPHRASE \mapsto \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Variants}{variant} ( \SEMHYPER{../.}{OC-L-03-Names}{constr-name} \LEFTPHRASE \ \VAR{CN} \ \RIGHTPHRASE , \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Tuples}{tuple} ( \ ) ) \} \\ \KEY{Rule} \quad & \SEMREF{define-constrs} \LEFTPHRASE \ \VARHYPER{../.}{OC-L-03-Names}{CN} \ \LEX{of} \ \VARREF{CA} \ \RIGHTPHRASE = \\&\quad \{ \SEMHYPER{../.}{OC-L-03-Names}{constr-name} \LEFTPHRASE \ \VAR{CN} \ \RIGHTPHRASE \mapsto \\&\quad\quad\quad \NAMEHYPER{../../../../../Funcons-beta/Values/Abstraction}{Functions}{function} \ \NAMEHYPER{../../../../../Funcons-beta/Values/Abstraction}{Generic}{closure} ( \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Variants}{variant} ( \SEMHYPER{../.}{OC-L-03-Names}{constr-name} \LEFTPHRASE \ \VAR{CN} \ \RIGHTPHRASE , \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Giving}{given} ) ) \} \end{align*}\]

Exception definitions

\[\begin{align*} \KEY{Semantics} \quad & \SEMDECL{define-exception} \LEFTPHRASE \ \_ : \SYNREF{exception-definition} \ \RIGHTPHRASE : \TO \NAMEHYPER{../../../../../Funcons-beta/Computations/Normal}{Binding}{environments} \\ \KEY{Rule} \quad & \SEMREF{define-exception} \LEFTPHRASE \ \LEX{exception} \ \VARREF{CD} \ \RIGHTPHRASE = \SEMREF{define-constrs} \LEFTPHRASE \ \VAR{CD} \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \SEMREF{define-exception} \LEFTPHRASE \ \LEX{exception} \ \VARHYPER{../.}{OC-L-03-Names}{CN} \ \LEX{{=}} \ \VARHYPER{../.}{OC-L-03-Names}{CSTR} \ \RIGHTPHRASE = \NAMEHYPER{../../../../../Funcons-beta/Values/Composite}{Maps}{map} ( \ ) \end{align*}\]