From: pimjager Date: Tue, 14 Jun 2016 21:46:20 +0000 (+0200) Subject: Improved stuff on Yard X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=51bb74b898430c4afbfef6e06a3b2abdfd414c77;p=cc1516.git Improved stuff on Yard --- diff --git a/deliverables/report/pars.tex b/deliverables/report/pars.tex index d64ec69..152c34a 100644 --- a/deliverables/report/pars.tex +++ b/deliverables/report/pars.tex @@ -2,10 +2,17 @@ \subsection{\Yard} For both lexing and parsing we use proof of concept state of the art minimal parser combinators library called \Yard. \Yard{} is inspired by the well-known -\textsc{Parsec} library. Where \Yard{} only has 9 parser combinators +\textsc{Parsec} library. Where \Yard{} only has 7 primitive parser (combinators) \textsc{Parsec} already has 9 categories of parser combinators with in every category there are numerous combinators. +Parsers implemented in Yard parse left to right and are greedy, that is they +always try to consume as +much input as possible, starting from the left most token encountered. +Yards parsers also automatically apply backtracking, +when the left parser combined with \CI{<|>} fails, then any input it might +have consumed is restored and the right parser is executed. + \begin{lstlisting}[language=Clean] :: Error = PositionalError Int Int String | Error String :: Parser a b = Parser ([a] -> (Either Error b, [a])) @@ -14,12 +21,16 @@ category there are numerous combinators. fail :: Parser a b top :: Parser a a peek :: Parser a a +eof :: Parser a Void +pure :: b -> Parser a b +(>>=) :: (Parser a b) (b -> Parser a c) -> Parser a c +(<|>) :: (Parer a b) (Parser a b) -> Parser a b +--derived parser functions satisfy :: (a -> Bool) -> Parser a a check :: (a -> Bool) -> Parser a a (until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b] item :: a -> Parser a a | Eq a list :: [a] -> Parser a [a] | Eq a -eof :: Parser a Void \end{lstlisting} \subsection{Lexing \& Grammar} diff --git a/deliverables/report/todo.txt b/deliverables/report/todo.txt index a0e5b5c..130480f 100644 --- a/deliverables/report/todo.txt +++ b/deliverables/report/todo.txt @@ -1,4 +1,4 @@ -pim parse: Uitleggen over YARD +VINK pim parse: Uitleggen over YARD VINK pim sem: sem opschonen appendix, die pagina landscape(package: lscape, \begin{lscape}) pim gen: abi en generation mart gen: higher order functions