enterprise-presentation/parsing.tex
2020-02-24 23:51:39 -06:00

53 lines
1.2 KiB
TeX

\begin{frame}[fragile]
\frametitle{Deep Dive into Parsing DSL Syntax}
\begin{columns}
\begin{column}{0.3\textwidth}
\begin{itemize}
\item Hand-rolled recursive-descent parser.
\item Why not use LR parser generator?
\end{itemize}
\end{column}
\begin{column}{0.55\textwidth}
\begin{verbatim}
component HelloWorld {
model {
name: String = "hello",
}
view {
<input bind:value="name" />
"Hello, " {name} "!"
}
}
\end{verbatim}
\end{column}
\end{columns}
\end{frame}
\begin{frame}[fragile]
\frametitle{Taking advantage of Rust syntax}
\begin{columns}
\begin{column}{0.4\textwidth}
\begin{verbatim}
// proc-macro library
pub enum TokenTree {
Group(Group),
Ident(Ident),
Punct(Punct),
Literal(Literal),
}
\end{verbatim}
\end{column}
\begin{column}{0.4\textwidth}
\begin{itemize}
\item Get \texttt{\{\}}-bracketed groups for free.
\item Easily tell identifiers from strings.
\item Punctuation has flexible representation.
\item Get literal parsing for free.
\end{itemize}
\end{column}
\end{columns}
\end{frame}