parsec Questions
3
Solved
I was expecting to find a function
integer :: Stream s m Char => ParsecT s u m Integer
or maybe even
natural :: Stream s m Char => ParsecT s u m Integer
in the standard libraries, but ...
1
Solved
Suppose I have a function of this type:
once :: (a, b) -> Parser (a, b)
Now, I would like to repeatedly apply this parser (somewhat like using >>=) and use its last output to feed it in t...
1
Solved
I was playing around with Haskell's parsec library. I was trying to parse a hexadecimal string of the form "#x[0-9A-Fa-f]*" into an integer. This the code I thought would work:
module Mai...
1
Solved
buildExpressionParser only deals with unary and binary operators. Can it handle ternary operators like ?:? There are some discussions here and here, but none is conclusive.
Deception asked 13/9, 2019 at 21:54
2
Not sure if this is possible (or recommended), but I am essentially trying to search for a sequence of characters in file using Parsec. Example file:
START (name)
junk
morejunk=junk;
dontcare
fo...
3
I have a file with line endings “\r\r\n”, and use the parser eol = string "\r\r\n" :: Parser String to handle them. To get a list of the lines between these separators, I would like to use sepBy al...
3
Solved
I need to parse a single select tag in a poorly formed HTML document (so XML-based parsers don't work).
I think I know how to use parsec to parse the select tag once I get there, but how do I ski...
4
Solved
How can I use parsec to parse all matched input in a string and discard the rest?
Example: I have a simple number parser, and I can find all the numbers if I know what separates them:
num :: Pa...
4
Solved
I'm looking at this library, which has little documentation:
https://pythonhosted.org/parsec/#examples
I understand there are alternatives, but I'd like to use this library.
I have the following ...
Gorgias asked 6/8, 2019 at 4:18
4
Using Parsec how does one indicate an error at a specific position if a semantic rule is violated. I know typically we don't want to do such things, but consider the example grammar.
<foo> :...
1
I need to give a failure message to a given position in parsec.
I tried by setting the position before giving an unexpected error message, but it didn't work:
runParser ( do pos0 <- getPositio...
6
Solved
I want to parse input strings like this: "this is \"test \" message \"sample\" text"
Now, I wrote a parser for parsing individual text without any quotes:
parseString :: Parser String
parseString...
5
Solved
I'm writing my first program with Parsec. I want to parse MySQL schema dumps and would like to come up with a nice way to parse strings representing certain keywords in case-insensitive fashion. He...
4
I am wondered why there is no generalized parser combinators for Bottom-up parsing in Haskell like a Parsec combinators for top down parsing.
( I could find some research work went during 2004 but...
Cell asked 5/6, 2014 at 2:57
2
Solved
I was reading a lot about Haskell Parser Combinators and found a lot of topics like:
Parsec vs Yacc/Bison/Antlr: Why and when to use Parsec?
Which Haskell parsing technology is most pleasant to u...
Magnetoelectricity asked 3/8, 2013 at 1:5
3
I've been working with parsec and I have trouble debugging my code. For example, I can set a breakpoint in ghci, but I'm not sure how to see how much of the input has been consumed, or things like ...
1
Solved
I would like to parse a basic indented language using Megaparsec. Originally I was using Parsec which I managed to get working correctly with indentation but now I'm having quite some trouble.
I'...
Centavo asked 15/1, 2018 at 21:57
0
for a small compiler project we are currently working on implementing a compiler for a subset of C for which we decided to use Haskell and megaparsec. Overall we made good progress but there are st...
Berger asked 2/11, 2017 at 21:58
1
Solved
I was wondering, if there is a standard, canonical way in Haskell to write not only a parser for a specific file format, but also a writer.
In my case, I need to parse a data file for analysis. Ho...
Subsist asked 21/7, 2017 at 13:49
3
Solved
I'm just starting with Parsec (having little experience in Haskell), and I'm a little confused about using monads or applicatives. The overall feel I had after reading "Real World Haskell", "Write ...
2
Say I want to parse a file in language X. Really, I'm only interested in a small part of the information within. It's easy enough to write a parser in one of Haskell's many eDSLs for that purpose (...
3
Solved
I was trying to use ghc-7.10 (RC 2) and got this message in a number of cases, e.g.,
src/Text/Regex/XMLSchema/Generic/RegexParser.hs:439:5:
Non type-variable argument
in the constraint: Text.Par...
1
Solved
I'm writing a programming language which uses Parsec for its parsing. For reporting error messages, I've got each element of my syntax tree labelled with its source location, using the getPosition ...
Haldeman asked 18/3, 2016 at 7:21
1
Solved
I'd like to implement this grammar rule using Haskell's parsec library:
((a | b | c)* (a | b))?
Which is a parser rule that accepts an optional (i.e. potentially empty) string. If the string it ...
3
Solved
I was wondering if there's a way to get te remaining input from Parsec after it stops parsing, either if it was a successful or failed parse, maybe this signature:
parseRemaining :: Stream s Ident...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.