diff --git a/src/background/parsers.pdf b/src/background/parsers.pdf index 0867609..83491d1 100644 Binary files a/src/background/parsers.pdf and b/src/background/parsers.pdf differ diff --git a/src/background/parsers.tex b/src/background/parsers.tex index 0f37371..446dfde 100644 --- a/src/background/parsers.tex +++ b/src/background/parsers.tex @@ -49,7 +49,7 @@ \subsection{The \texttt{parsley} Library} \langle \mathit{atom} \rangle &::= \text{`\texttt{(}'} \; \langle \mathit{expr} \rangle \; \text{`\texttt{)}'} \enspace | \enspace \langle \mathit{number} \rangle \end{align*} -\caption{The grammar in \textsc{ebnf}.} +\caption{The grammar in e\textsc{bnf}.} \label{fig:simple-grammar-ebnf} \end{subfigure} \hfill diff --git a/src/evaluation/evaluation.pdf b/src/evaluation/evaluation.pdf index 516524d..bbd5beb 100644 Binary files a/src/evaluation/evaluation.pdf and b/src/evaluation/evaluation.pdf differ diff --git a/src/evaluation/evaluation.tex b/src/evaluation/evaluation.tex index 2518b68..f0e7d56 100644 --- a/src/evaluation/evaluation.tex +++ b/src/evaluation/evaluation.tex @@ -20,8 +20,6 @@ \section{Removing Left-Recursion}\label{sec:eval-leftrec} \item How clear was the output? How does it compare to an idiomatic, manually fixed version? \item Does the output compile? \end{itemize} -% Given the nature of the transformation, it is difficult to provide quantitative metrics for evaluation, so the focus will be on qualitative aspects. -% Given the lack of a direct competitor, the evaluation will be based on the author's experience with the tool and the quality of the output produced. % The following examples assume the existence of a \scala{number} parser, defined the same way as earlier in \cref{sec:background-parsers}: \begin{minted}{scala} @@ -241,6 +239,9 @@ \subsection*{Summary} \end{itemize} % TODO: library ergonomics - see ethan's thesis +% e.g. Introduce implicit conversions rule -- stunted because no in-editor support +% want to be able to preview changes in editor, and also apply auto-fixes one by one + % TODO: benchmarks here? % A large corpus of student WACC parsers is available to evaluate the real-world applicability of \texttt{parsley-garnish}. diff --git a/src/introduction/introduction.pdf b/src/introduction/introduction.pdf index e277fe1..cfc96e2 100644 Binary files a/src/introduction/introduction.pdf and b/src/introduction/introduction.pdf differ diff --git a/src/introduction/introduction.tex b/src/introduction/introduction.tex index 7732b46..4367521 100644 --- a/src/introduction/introduction.tex +++ b/src/introduction/introduction.tex @@ -65,6 +65,9 @@ A linter with knowledge of the \texttt{parsley} library could help users by providing \emph{relevant} suggestions at the \emph{precise} location of the issue: \begin{minted}{scala} lazy val expr: Parsley[Float] = (expr, char('+') ~> term).zipped(_ + _) +\end{minted} +\vspace{-4ex} +\begin{minted}[baselinestretch=1]{scala} // ^^^^^^^^^^^^^^^^^^^^ // Warning: This parser is left-recursive, which will cause an infinite loop when parsing. // Suggestion: Refactor using chain combinators from the parsley.expr module, @@ -77,6 +80,9 @@ Thus, a linter could also aid users in learning about \texttt{parsley} idioms and best practices: \begin{minted}{scala} lazy val atom: Parsley[Float] = char('(') ~> expr <~ char(')') | number +\end{minted} +\vspace{-4ex} +\begin{minted}[baselinestretch=1]{scala} // ^^^^^^^^^ ^^^^^^^^^ // Info: Explicit usage of the 'char' combinator may not be necessary. // Suggestion [auto-fix available]: Use implicit conversions: @@ -88,6 +94,7 @@ // ─┬─ ─┬─ // Remove char combinators ────┴──────────────┘ \end{minted} +% ^ why do the box chars not connect vertically?? % The aim of \texttt{parsley-garnish} is to provide relevant linting rules, like the above, to guide users towards writing improved \texttt{parsley} code. With useful hints and automatic fixes, our hypothetical user can be steered towards a correct and idiomatic parser: @@ -102,7 +109,7 @@ \end{minted} % With this definition of \scala{expr}, the parser is able to parse left-associative expressions without left-recursion, and the syntactic noise of the \scala{char} combinators has been removed. -Executing \scala{expr.parse("1+2*3/4")} now correctly evaluates to \scala{2.5}! +Executing \scala{expr.parse("1+2*3/4")} now evaluates to \scala{2.5}, as expected! % Introduces domain-specific lint rules for Parsec-style parser combinator libraries % Implementation of these rules for Parsley Scala