squiggle/spec/src/syntax.tex
2022-03-30 06:11:57 -04:00

34 lines
1.3 KiB
TeX

\documentclass[../main.tex]{subfiles}
\begin{document}
\section{Syntax}\label{section:syntax}
Details about assignment and arithmetic on floats will follow eventually, but I want to sketch out a theory of combining distributions, first.
Abstractly, you can think of Squiggle as containing two types
\begin{grammar}
<type> ::= <GenericDist> \alt \texttt{float}
\end{grammar}\label{gram:type}
Where \texttt{float} is ordinary IEEE754 floating point numbers, and $\langle \textit{GenericDist} \rangle$ is as follows
\begin{grammar}
<GenericDist> ::= <PointSetDist> \alt \texttt{SampleSet} \alt <Symbolic>
<PointSetDist> ::= <Mixed> \alt <Continuous> \alt <Discrete>
<Symbolic> ::= \texttt{Normal} \alt \texttt{LogNormal} \alt \texttt{Triangular} \alt \texttt{Beta} \alt \texttt{Uniform} \alt \texttt{Float} \alt \texttt{Exponential} \alt \texttt{Cauchy}
\end{grammar}
From a grammatical perspective \texttt{SampleSet} and all of the alternatives of $\langle \textit{Symbolic} \rangle$ are \textit{black boxes}. They needn't be discussed from this point of view.
Finally, most of the magic happens in $\langle \textit{Expression} \rangle$
\begin{grammar}
<Factor> ::= <GenericDist> \alt \texttt{float} \alt <Factor> * <Factor> \alt <Factor> .* <Factor>
<Expression> ::= <Factor> + <Factor> \alt <Factor> .+ <Factor>
\end{grammar}
\end{document}