Improved stuff on Yard
authorpimjager <pim@pimjager.nl>
Tue, 14 Jun 2016 21:46:20 +0000 (23:46 +0200)
committerpimjager <pim@pimjager.nl>
Tue, 14 Jun 2016 21:46:20 +0000 (23:46 +0200)
deliverables/report/pars.tex
deliverables/report/todo.txt

index d64ec69..152c34a 100644 (file)
@@ -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}
index a0e5b5c..130480f 100644 (file)
@@ -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