Link Search Menu Expand Document
\( % cbs-katex.sty % \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 text or 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`\~} % \FUN{name} highlights the name. % \FUNDEC{name} declares Name.name as the target of links to name. % \FUNREF{name} links name to the target Name.name in the current file. % \FUNHYP{url}{file}{name} links name to Name.name at url/file/index.html. % 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#1}} % PLAIN \newcommand{\STYLE}[2]{\htmlClass{cbs-#1}{#2}} \newcommand{\VAR}[1]{\STYLE{PartVariable}{\textit{#1\kern2mu}}} \newcommand{\FUN}[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}}} \newcommand{\LANG}[1]{\STYLE{Language}{\textsf{#1}}} % DEC \newcommand{\DEC}[3]{\htmlId{#1:#2}{#3}} \newcommand{\VARDEC}[1]{\DEC{PartVariable}{#1}{\VAR{#1}}} \newcommand{\FUNDEC}[1]{\DEC{Name}{#1}{\FUN{#1}}} \newcommand{\SYNDEC}[1]{\DEC{SyntaxName}{#1}{\SYN{#1}}} \newcommand{\SEMDEC}[1]{\DEC{SemanticsName}{#1}{\SEM{#1}}} \newcommand{\SECTDEC}[1]{\DEC{SectionNumber}{#1}{\textsf{#1}}} % \newcommand{\LANGDEC}[1]{\DEC{Language}{#1}{\LANG{#1}}} % REF \newcommand{\REF}[3]{\href{###1:#2}{#3}} \newcommand{\VARREF}[1]{\REF{PartVariable}{#1}{\VAR{#1}}} \newcommand{\FUNREF}[1]{\REF{Name}{#1}{\FUN{#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}}} % \newcommand{\LANGREF}[1]{\REF{Language}{#1}{\LANG{#1}}} % HYP \newcommand{\HYP}[5]{\href{#1/#2/index.html###3:#4}{#5}} \newcommand{\VARHYP}[3]{\HYP{#1}{#2}{PartVariable}{#3}{\VAR{#3}}} \newcommand{\FUNHYP}[3]{\HYP{#1}{#2}{Name}{#3}{\FUN{#3}}} \newcommand{\SYNHYP}[3]{\HYP{#1}{#2}{SyntaxName}{#3}{\SYN{#3}}} \newcommand{\SEMHYP}[3]{\HYP{#1}{#2}{SemanticsName}{#3}{\SEM{#3}}} \newcommand{\SECTHYP}[3]{\HYP{#1}{#2}{SectionNumber}{#3}{\SECT{#3}}} % \newcommand{\LANGHYP}[3]{\HYP{#1}{#2}{Language}{#3}{\LANG{#3}}} % CBS-beta/math hyperlinks \newcommand\CBSBETAMATH{https://plancomps.github.io/CBS-beta/math} \newcommand\VARCBS[3]{\VARHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand\FUNCBS[3]{\FUNHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand\SYNCBS[3]{\SYNHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand\SEMCBS[3]{\SEMHYP{\CBSBETAMATH/#1}{#2}{#3}} \newcommand\SECTCBS[3]{\SECTHYP{\CBSBETAMATH/#1}{#2}{#3}} % \newcommand{\LANGCBS}[3]{\LANGHYP{\CBSBETAMATH/#1}{#2}{#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}{conclusion} produces % premise % ---------- % conclusion \newcommand{\RULE}[2]{\mkern-2.2mu\frac{\displaystyle#1}{\displaystyle#2}} % See https://tex.stackexchange.com/questions/337328/superscripts-appear-in-various-weird-places-in-fractions % \RULE % {\begin{aligned} & premise \\ & ... \end{aligned}} % {\begin{aligned} & conclusion ... \\ & ... \end{aligned}} % produces an inference rule with left-aligned premises and split conclusion % premise % ... % -------------- % conclusion ... % ... % \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 \)
\( \renewcommand{\HYP}[5]{\REF{#3}{#4}{#5}} \)

This page is using \(\KaTeX\). See the same page using MathJax-3.

Links to non-local declarations are disabled on this sample page.


\[\KEY{Language} \quad \LANG{\STRING{SIMPLE}}\]

\(\SECT{3}\) Statements

\[\begin{align*} \KEY{Syntax} \quad \VARDEC{Block} : \SYNDEC{block} \ ::= \ & \ \LEX{{\LEFTBRACE}} \ \SYN@stmts\QUERY \ \LEX{{\RIGHTBRACE}} \\ \VARDEC{Stmts} : \SYNDEC{stmts} \ ::= \ & \ \SYN@stmt \ \SYN@stmts\QUERY \\ \VARDEC{Stmt} : \SYNDEC{stmt} \ ::= \ & \ \SYN@imp@stmt \mid \SYN@vars@decl \\ \VARDEC{ImpStmt} : \SYNDEC{imp-stmt} \ ::= \ & \ \SYN@block \\ \ \mid \ & \ \SYN@exp \ \LEX{{;}} \\ \ \mid \ & \ \LEX{if} \ \LEX{{(}} \ \SYN@exp \ \LEX{{)}} \ \SYN@block \ \LEFTGROUP \LEX{else} \ \SYN@block \RIGHTGROUP\QUERY \\ \ \mid \ & \ \LEX{while} \ \LEX{{(}} \ \SYN@exp \ \LEX{{)}} \ \SYN@block \\ \ \mid \ & \ \LEX{for} \ \LEX{{(}} \ \SYN@stmt \ \SYN@exp \ \LEX{{;}} \ \SYN@exp \ \LEX{{)}} \ \SYN@block \\ \ \mid \ & \ \LEX{print} \ \LEX{{(}} \ \SYN@exps \ \LEX{{)}} \ \LEX{{;}} \\ \ \mid \ & \ \LEX{return} \ \SYN@exp\QUERY \ \LEX{{;}} \\ \ \mid \ & \ \LEX{try} \ \SYN@block \ \LEX{catch} \ \LEX{{(}} \ \SYN@id \ \LEX{{)}} \ \SYN@block \\ \ \mid \ & \ \LEX{throw} \ \SYN@exp \ \LEX{{;}} \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VAR@Exp \ \LEX{{)}} \ \VAR@Block \ \RIGHTPHRASE : \SYN@stmt = \\& \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VAR{Exp} \ \LEX{{)}} \ \VAR{Block} \ \LEX{else} \ \LEX{{\LEFTBRACE}} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \LEFTPHRASE \ \LEX{for} \ \LEX{{(}} \ \VAR@Stmt \ \VAR@Exp\SUB{1} \ \LEX{{;}} \ \VAR@Exp\SUB{2} \ \LEX{{)}} \\&\quad \LEX{{\LEFTBRACE}} \ \VAR@Stmts \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE : \SYN@stmt = \\& \LEFTPHRASE \ \LEX{{\LEFTBRACE}} \ \VAR{Stmt} \\&\quad \LEX{while} \ \LEX{{(}} \ \VAR{Exp}\SUB{1} \ \LEX{{)}} \\&\quad \LEX{{\LEFTBRACE}} \ \LEX{{\LEFTBRACE}} \ \VAR{Stmts} \ \LEX{{\RIGHTBRACE}} \ \VAR{Exp}\SUB{2} \ \LEX{{;}} \ \LEX{{\RIGHTBRACE}} \\&\quad \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE \end{align*}\] \[\begin{align*} \KEY{Semantics} \quad & \SEMDEC{exec} \LEFTPHRASE \ \_ : \SYN@stmts \ \RIGHTPHRASE : \TO \FUN@null@type \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{{\LEFTBRACE}} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE = \FUN@null \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{{\LEFTBRACE}} \ \VAR@Stmts \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE = \SEM@exec \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VAR@ImpStmt \ \VAR@Stmts \ \RIGHTPHRASE = \\&\quad \FUN@sequential ( \SEM@exec \LEFTPHRASE \ \VAR{ImpStmt} \ \RIGHTPHRASE , \SEM@exec \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VAR@VarsDecl \ \VAR@Stmts \ \RIGHTPHRASE = \\&\quad \FUN@scope ( \SEM@declare \LEFTPHRASE \ \VAR{VarsDecl} \ \RIGHTPHRASE , \SEM@exec \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VAR@VarsDecl \ \RIGHTPHRASE = \FUN@effect ( \SEM@declare \LEFTPHRASE \ \VAR{VarsDecl} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VAR@Exp \ \LEX{{;}} \ \RIGHTPHRASE = \FUN@effect ( \SEM@rval \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VAR@Exp \ \LEX{{)}} \ \VAR@Block\SUB{1} \ \LEX{else} \ \VAR@Block\SUB{2} \ \RIGHTPHRASE = \\&\quad \FUN@if@else ( \SEM@rval \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE , \SEM@exec \LEFTPHRASE \ \VAR{Block}\SUB{1} \ \RIGHTPHRASE , \SEM@exec \LEFTPHRASE \ \VAR{Block}\SUB{2} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{while} \ \LEX{{(}} \ \VAR@Exp \ \LEX{{)}} \ \VAR@Block \ \RIGHTPHRASE = \FUN@while ( \SEM@rval \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE , \SEM@exec \LEFTPHRASE \ \VAR{Block} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{print} \ \LEX{{(}} \ \VAR@Exps \ \LEX{{)}} \ \LEX{{;}} \ \RIGHTPHRASE = \FUN@print ( \SEM@rvals \LEFTPHRASE \ \VAR{Exps} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{return} \ \VAR@Exp \ \LEX{{;}} \ \RIGHTPHRASE = \FUN@return ( \SEM@rval \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{return} \ \LEX{{;}} \ \RIGHTPHRASE = \FUN@return ( \FUN@null ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{try} \ \VAR@Block\SUB{1} \ \LEX{catch} \ \LEX{{(}} \ \VAR@Id \ \LEX{{)}} \ \VAR@Block\SUB{2} \ \RIGHTPHRASE = \\&\quad \FUN@handle@thrown ( \\&\quad\quad \SEM@exec \LEFTPHRASE \ \VAR{Block}\SUB{1} \ \RIGHTPHRASE , \\&\quad\quad \FUN@scope ( \\&\quad\quad\quad \FUN@bind ( \SEM@id \LEFTPHRASE \ \VAR{Id} \ \RIGHTPHRASE , \FUN@allocate@initialised@variable ( \FUN@values, \FUN@given ) ), \\&\quad\quad\quad \SEM@exec \LEFTPHRASE \ \VAR{Block}\SUB{2} \ \RIGHTPHRASE ) ) \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{throw} \ \VAR@Exp \ \LEX{{;}} \ \RIGHTPHRASE = \FUN@throw ( \SEM@rval \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \end{align*}\]