Skip to content

Instantly share code, notes, and snippets.

@texdraft
Created November 10, 2025 21:56
Show Gist options
  • Select an option

  • Save texdraft/4b52e1e9551c1824e6483113bc293323 to your computer and use it in GitHub Desktop.

Select an option

Save texdraft/4b52e1e9551c1824e6483113bc293323 to your computer and use it in GitHub Desktop.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{simplebnf}
\def\colon{:}
\def\tyvar{\alpha}
\def\clsname{C}
\def\method{m}
\def\termvar{x}
\def\instvar{\iota}
\def\tycon{\chi}
\def\kindnt{\kappa}
\def\typent{\tau}
\def\karrow{\Rrightarrow}
\def\defenv{\Delta}
\begin{document}
\begin{center}
\begin{bnf}(
relation-sym-map =
{
{::=} = {\ensuremath{\Coloneqq}},
{:in:} = {},
},
)
$\tyvar$ : type variable :in:
;;
$\instvar$ : instance variable :in:
;;
$\clsname$ : class name :in:
;;
$\tycon$ : type constructor :in:
;;
$\termvar$ : term variable :in:
;;
$\method$ : method name :in:
;;
\end{bnf}
\bigskip
\begin{bnf}
$p$ : programs ::=
| $d_1;\dots;d_n;e$ : ($n\ge0$)
;;
$d$ : declarations ::=
| $\mathbf{type}\ \theta \Rightarrow \tyvar \colon \kindnt = \tau$ : type declaration
| $\mathbf{type}\ \clsname = c$ : class declaration
| $\mathbf{type}\ \iota = i$ : instance declaration
;;
$c$ : class expressions ::=
| $\theta \Rightarrow \langle \method\colon\tau\rangle$
;;
$i$ : instance expressions ::=
| $\theta \Rightarrow \clsname (\tycon\ \tau)\ \langle \method=e\rangle$
;;
$\typent$ : types ::=
| $\tyvar$ : type variable
| $\forall\tyvar\colon \kindnt.\typent$ : universal type
| $\typent\rightarrow\typent$ : function type
| $\tycon\ \typent$ : type application
| $\theta\Rightarrow\typent$ : constrained type
| $\typent\Leftarrow\instvar$ : instance supply
;;
$\theta$ : constraints ::=
| $\clsname\ \typent\ \mathbf{as}\ \instvar$
;;
$e$ : expressions ::=
| $\termvar$ : variable
| $\instvar.\method$ : method access
| $\lambda \termvar \colon \typent . e$ : abstraction
| $\Lambda \termvar \colon \kindnt. e$ : type abstraction
| $e\ e$ : application
| $e\ [e]$ : type application
| $e \Leftarrow \instvar$ : instance supply
;;
$\kindnt$ : kinds ::=
| $\star$ : type
| $\mathcal{I}$ : instance
| $\mathcal{C}$ : constraint
| $\kindnt\karrow\kindnt$ : type function
;;
\end{bnf}
\end{center}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment