diff options
author | Camil Staps | 2016-05-10 21:12:44 +0200 |
---|---|---|
committer | Camil Staps | 2016-05-10 21:12:44 +0200 |
commit | d2b12fdf5681a71f1f6a295b0591e4d8213fb41d (patch) | |
tree | c242637b4491ce3d1a44b6f8b51f398f20fc0daf /paper/While/Yard.dcl | |
parent | Makefile: bibtex may fail (diff) |
Straightforward While lexer, parser and interpreter
Diffstat (limited to 'paper/While/Yard.dcl')
-rw-r--r-- | paper/While/Yard.dcl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/paper/While/Yard.dcl b/paper/While/Yard.dcl new file mode 100644 index 0000000..1fcbfea --- /dev/null +++ b/paper/While/Yard.dcl @@ -0,0 +1,27 @@ +definition module Yard + +// Stolen from https://github.com/dopefishh/cc1516/blob/master/yard.dcl; +// minor changes made to not depend on clean-platform + +from StdString import class toString +from StdClass import class == + +import Common + +:: Parser a b = Parser ([a] -> (Either Error b, [a])) + +instance Functor (Parser a) +instance Applicative (Parser a) +instance Monad (Parser a) +instance Alternative (Parser a) + +runParser :: (Parser a b) [a] -> (Either Error b, [a]) +(<?>) :: (Parser a b) Error -> Parser a b +fail :: Parser a b +top :: Parser a a +peek :: Parser a a +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 | == a +list :: [a] -> Parser a [a] | == a |