Link Search Menu Expand Document
\( % cbs-mathjax.sty % For use with mathjax-3.html. % For formatting pages using CBS with MathJax-3. % When using Jekyll, include this file in a page by adding to the front matter: % layout: cbs-mathjax % or: % layout: cbs-mathjax-local % The macros support formatting all of CBS. The MathJax-3 rendering is % compatible with the LaTeX rendering of articles that use cbs-latex.sty. % The colors are specified using CSS, so that they can be changed according % to the page background color. % The configuration tex block should include: % maxBuffer : 10 * 1024 % The output block should include: % mtextFont: 'sans-serif' % See the docs at: % ??? \newcommand{\llbracket}{[\![} \newcommand{\rrbracket}{]\!]} \newcommand{\nobreak}{} % \SHADE{MATH} can be defined to produce a shaded background to highlight % inline MATH in running text: \newcommand{\SHADE}[1]{#1} % \STYLE{STYLE-NAME}{TEXT-OR-MATH} lets CSS determine the color of TEXT-OR-MATH, % so that it can change when a web page changes between light and dark modes. % STYLE-NAME should be either Key, PartVariable, Name, SyntaxName, SemanticsName, % Language, or SectNumber. % TO DO: Improve the style names! \newcommand{\STYLE}[2]{\class{cbs-#1}{#2}} % \KEY{text}, \STRING{text}, \ATOM{text}, \LEX{text} can be used in text or math. % When the MathJax configuration includes mtextFont: 'sans-serif', \KEY{text} % renders as slanted sans-serif, but \VAR{text} still renders in a serif font. \newcommand{\KEY}[1]{\textit{\STYLE{Key}{#1}}} \newcommand{\STRING}[1]{\text{``$\mathtt{#1}$''}} \newcommand{\ATOM}[1]{\text{`$\mathtt{#1}$'}} \newcommand{\LEX}[1]{\text{\STYLE{Key}{`}$\mathtt{#1}$\STYLE{Key}{'}}} % The following commands produce ASCII characters that are treated specially by LaTeX: \newcommand{\HASH}{\unicode{x0023}} % {\char`\#} \newcommand{\DOLLAR}{\unicode{x0024}} % {\char`\$} \newcommand{\PERCENT}{\unicode{x0025}} % {\char`\%} \newcommand{\AMPERSAND}{\unicode{x0026}} % {\char`\&} \newcommand{\APOSTROPHE}{\unicode{x0027}} % {\char`\'} \newcommand{\BACKSLASH}{\unicode{x005c}} % {\char`\\} \newcommand{\CARET}{\unicode{x005e}} % {\char`\^} \newcommand{\UNDERSCORE}{\unicode{x005f}} % {\char`\_} \newcommand{\GRAVE}{\unicode{x0060}} % {\char`\`} \newcommand{\LEFTBRACE}{\unicode{x007b}} % {\char`\{} \newcommand{\RIGHTBRACE}{\unicode{x007d}} % {\char`\}} \newcommand{\TILDE}{\unicode{x007e}} % {\textasciitilde} % \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/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}{#1}}} % PLAIN \newcommand{\VAR}[1]{\STYLE{PartVariable}{\it#1\kern2mu}} % \it#1 currently formats #1 in the text italic font, independently of mtextFont. \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}{#1}} % DEC \newcommand{\DEC}[3]{\smash{\raise{2.4ex}{\cssId{#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%3A#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%3A#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]{\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]{#5} \)

This page is using MathJax-3. See the same page using MathJax-2.7.

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}} \ \SYNREF{stmts}\QUERY \ \LEX{{\RIGHTBRACE}} \\ \VARDEC{Stmts} : \SYNDEC{stmts} \ ::= \ & \ \SYNREF{stmt} \ \SYNREF{stmts}\QUERY \\ \VARDEC{Stmt} : \SYNDEC{stmt} \ ::= \ & \ \SYNREF{imp-stmt} \mid \SYNHYP{../.}{SIMPLE-4-Declarations}{vars-decl} \\ \VARDEC{ImpStmt} : \SYNDEC{imp-stmt} \ ::= \ & \ \SYNREF{block} \\ \ \mid \ & \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{;}} \\ \ \mid \ & \ \LEX{if} \ \LEX{{(}} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{)}} \ \SYNREF{block} \ \LEFTGROUP \LEX{else} \ \SYNREF{block} \RIGHTGROUP\QUERY \\ \ \mid \ & \ \LEX{while} \ \LEX{{(}} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{)}} \ \SYNREF{block} \\ \ \mid \ & \ \LEX{for} \ \LEX{{(}} \ \SYNREF{stmt} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{;}} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{)}} \ \SYNREF{block} \\ \ \mid \ & \ \LEX{print} \ \LEX{{(}} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exps} \ \LEX{{)}} \ \LEX{{;}} \\ \ \mid \ & \ \LEX{return} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp}\QUERY \ \LEX{{;}} \\ \ \mid \ & \ \LEX{try} \ \SYNREF{block} \ \LEX{catch} \ \LEX{{(}} \ \SYNHYP{../.}{SIMPLE-1-Lexical}{id} \ \LEX{{)}} \ \SYNREF{block} \\ \ \mid \ & \ \LEX{throw} \ \SYNHYP{../.}{SIMPLE-2-Expressions}{exp} \ \LEX{{;}} \end{align*}\] \[\begin{align*} \KEY{Rule} \quad & \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{)}} \ \VARREF{Block} \ \RIGHTPHRASE : \SYNREF{stmt} = \\& \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VAR{Exp} \ \LEX{{)}} \ \VAR{Block} \ \LEX{else} \ \LEX{{\LEFTBRACE}} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \LEFTPHRASE \ \LEX{for} \ \LEX{{(}} \ \VARREF{Stmt} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp}\SUB{1} \ \LEX{{;}} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp}\SUB{2} \ \LEX{{)}} \\&\quad \LEX{{\LEFTBRACE}} \ \VARREF{Stmts} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE : \SYNREF{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 \ \_ : \SYNREF{stmts} \ \RIGHTPHRASE : \TO \FUNHYP{../../../../../Funcons-beta/Values/Primitive}{Null}{null-type} \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{{\LEFTBRACE}} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Values/Primitive}{Null}{null} \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{{\LEFTBRACE}} \ \VARREF{Stmts} \ \LEX{{\RIGHTBRACE}} \ \RIGHTPHRASE = \SEMREF{exec} \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VARREF{ImpStmt} \ \VARREF{Stmts} \ \RIGHTPHRASE = \\&\quad \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Flowing}{sequential} ( \SEMREF{exec} \LEFTPHRASE \ \VAR{ImpStmt} \ \RIGHTPHRASE , \SEMREF{exec} \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VARHYP{../.}{SIMPLE-4-Declarations}{VarsDecl} \ \VARREF{Stmts} \ \RIGHTPHRASE = \\&\quad \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Binding}{scope} ( \SEMHYP{../.}{SIMPLE-4-Declarations}{declare} \LEFTPHRASE \ \VAR{VarsDecl} \ \RIGHTPHRASE , \SEMREF{exec} \LEFTPHRASE \ \VAR{Stmts} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VARHYP{../.}{SIMPLE-4-Declarations}{VarsDecl} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Flowing}{effect} ( \SEMHYP{../.}{SIMPLE-4-Declarations}{declare} \LEFTPHRASE \ \VAR{VarsDecl} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{;}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Flowing}{effect} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rval} \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{if} \ \LEX{{(}} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{)}} \ \VARREF{Block}\SUB{1} \ \LEX{else} \ \VARREF{Block}\SUB{2} \ \RIGHTPHRASE = \\&\quad \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Flowing}{if-else} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rval} \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE , \SEMREF{exec} \LEFTPHRASE \ \VAR{Block}\SUB{1} \ \RIGHTPHRASE , \SEMREF{exec} \LEFTPHRASE \ \VAR{Block}\SUB{2} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{while} \ \LEX{{(}} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{)}} \ \VARREF{Block} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Flowing}{while} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rval} \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE , \SEMREF{exec} \LEFTPHRASE \ \VAR{Block} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{print} \ \LEX{{(}} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exps} \ \LEX{{)}} \ \LEX{{;}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Interacting}{print} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rvals} \LEFTPHRASE \ \VAR{Exps} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{return} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{;}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Abnormal}{Returning}{return} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rval} \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{return} \ \LEX{{;}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Abnormal}{Returning}{return} ( \FUNHYP{../../../../../Funcons-beta/Values/Primitive}{Null}{null} ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{try} \ \VARREF{Block}\SUB{1} \ \LEX{catch} \ \LEX{{(}} \ \VARHYP{../.}{SIMPLE-1-Lexical}{Id} \ \LEX{{)}} \ \VARREF{Block}\SUB{2} \ \RIGHTPHRASE = \\&\quad \FUNHYP{../../../../../Funcons-beta/Computations/Abnormal}{Throwing}{handle-thrown} ( \\&\quad\quad \SEMREF{exec} \LEFTPHRASE \ \VAR{Block}\SUB{1} \ \RIGHTPHRASE , \\&\quad\quad \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Binding}{scope} ( \\&\quad\quad\quad \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Binding}{bind} ( \SEMHYP{../.}{SIMPLE-1-Lexical}{id} \LEFTPHRASE \ \VAR{Id} \ \RIGHTPHRASE , \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Storing}{allocate-initialised-variable} ( \FUNHYP{../../../../../Funcons-beta/Values}{Value-Types}{values}, \FUNHYP{../../../../../Funcons-beta/Computations/Normal}{Giving}{given} ) ), \\&\quad\quad\quad \SEMREF{exec} \LEFTPHRASE \ \VAR{Block}\SUB{2} \ \RIGHTPHRASE ) ) \\ \KEY{Rule} \quad & \SEMREF{exec} \LEFTPHRASE \ \LEX{throw} \ \VARHYP{../.}{SIMPLE-2-Expressions}{Exp} \ \LEX{{;}} \ \RIGHTPHRASE = \FUNHYP{../../../../../Funcons-beta/Computations/Abnormal}{Throwing}{throw} ( \SEMHYP{../.}{SIMPLE-2-Expressions}{rval} \LEFTPHRASE \ \VAR{Exp} \ \RIGHTPHRASE ) \end{align*}\]