appositum / parsero Goto Github PK
View Code? Open in Web Editor NEWParser combinators
License: Apache License 2.0
Parser combinators
License: Apache License 2.0
tab :: Parser Char
newline :: Parser Char
anyChar :: Parser Char
notChar :: Char -> Parser Char
0xFF
-> 255
0o20
-> 16
0b1001
-> 9
λ> parse stringLiteral "\"string example\""
(Left EndOfStream,"")
λ> parse stringLiteral' "'string example'"
(Left EndOfStream,"")
symbolic :: Char -> Parser Char
braces :: Parser a -> Parser a
(between {}
)brackets :: Parser a -> Parser a
(between []
)parens :: Parser a -> Parser a
(between ()
)angles :: Parser a -> Parser a
(between <>
)comma :: Parser Char
colon :: Parser Char
dot :: Parser Char
semicolon :: Parser Char
integerOrDouble :: Parser (Either Integer Double)
naturalOrDouble :: Parser (Either Integer Double)
charLiteral :: Parser Char
stringLiteral :: Parser String
stringLiteral' :: Parser String
(single quotes)cuceta master $ nix-shell
Preprocessing library for cuceta-0.1.0.0..
GHCi, version 8.4.4: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/eddie/.ghci
[1 of 6] Compiling Paths_cuceta ( dist/build/autogen/Paths_cuceta.hs, interpreted )
[2 of 6] Compiling Text.Cuceta.Parser ( src/Text/Cuceta/Parser.hs, interpreted )
[3 of 6] Compiling Text.Cuceta.Combinators ( src/Text/Cuceta/Combinators.hs, interpreted )
[4 of 6] Compiling Text.Cuceta.Char ( src/Text/Cuceta/Char.hs, interpreted )
[5 of 6] Compiling Text.Cuceta.Tokenizer ( src/Text/Cuceta/Tokenizer.hs, interpreted )
[6 of 6] Compiling Text.Cuceta ( src/Text/Cuceta.hs, interpreted )
Ok, six modules loaded.
λ> :q
Leaving GHCi.
Preprocessing library for cuceta-0.1.0.0..
GHCi, version 8.4.4: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/eddie/.ghci
[1 of 6] Compiling Paths_cuceta ( dist/build/autogen/Paths_cuceta.hs, interpreted )
[2 of 6] Compiling Text.Cuceta.Parser ( src/Text/Cuceta/Parser.hs, interpreted )
[3 of 6] Compiling Text.Cuceta.Combinators ( src/Text/Cuceta/Combinators.hs, interpreted )
[4 of 6] Compiling Text.Cuceta.Char ( src/Text/Cuceta/Char.hs, interpreted )
[5 of 6] Compiling Text.Cuceta.Tokenizer ( src/Text/Cuceta/Tokenizer.hs, interpreted )
[6 of 6] Compiling Text.Cuceta ( src/Text/Cuceta.hs, interpreted )
Ok, six modules loaded.
λ> :q
Leaving GHCi.
[nix-shell:~/Desktop/cuceta]$
The Parser
type takes two arguments: the stream type and the result type. That leads to all parser functions being written like this: p :: Stream s => Parser s a
. Changing the constructor to Parsero/MkParsero
would let us define a type synonym specifying which stream type we want to use, avoiding repetition: type Parser = Parsero Text
choice :: [Parser a] -> Parser a
option :: a -> Parser a -> Parser a
surroundedBy :: Parser a -> Parser s -> Parser a
try :: Parser a -> Parser a
sepBy :: [Parser a] -> Parser a
sepBy1 :: [Parser a] -> Parser a
eol :: Parser Char
po ai ce me fode ne meu parsero... kk
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.