Skip to main content
2 votes
1 answer
81 views

I'm creating a toy language in Haskell, and using Text.Parsec to parse everything, So far it's worked great, but there's a certain feature that I don't know how to implement: What I want to implement: ...
buzzbuzz20xx's user avatar
1 vote
1 answer
104 views

type P = ParsecT Void String (ReaderT UI IO) UI type Q = ParsecT Void String ((->) UI) (UI -> UI,String) I know how to do this: type Q' = ParsecT Void String ((->) UI) (UI,String) qtoq' p = ...
Ashok Kimmel's user avatar
0 votes
1 answer
96 views

I've tried ghci> :m +Text.Megaparsec ghci> :m +Data.Void ghci> :m +System.Timeout ghci> :m +Text.Megaparsec.Char ghci> timeout (15*10^(6::Int)) $ parseTest (some (many digitChar :: ...
phoxd's user avatar
  • 1,652
1 vote
1 answer
116 views

This is my current code for multiplying the first and last numbers in a string type Parser = Parsec Void String parsefirst :: Parser Int parsefirst = do getnotdigits x <- some digitChar ...
Ashok Kimmel's user avatar
3 votes
1 answer
197 views

I am trying to understand the behavior of many in the Megaparsec library for Haskell. I would have thought that many returns an empty list when its input parser fails, but this does not seem to be the ...
Vincent Moreau's user avatar
4 votes
1 answer
195 views

Here's my toy file: import Text.Megaparsec import Text.Megaparsec.Char import Data.Void (Void) type Parser = Parsec Void String myParser :: Parser String myParser = do d <- digitChar ...
IssaRice's user avatar
  • 391
2 votes
2 answers
364 views

I am writing a parser for a markdown-like document format. I want to be able to match something like ^[some *formatted* text] as a footnote in my syntax definition. Here's a minimal example: {- cabal: ...
GTF's user avatar
  • 8,435
3 votes
1 answer
123 views

I am attempting to develop a lambda calculus interpreter, which supports definitions of terms. For that, I'm using the Megaparsec library in Haskell. I have the following grammar: term := var | lambda ...
jpyamamoto's user avatar
0 votes
1 answer
73 views

I'm working through a DNS message parser. I have defined the following using megaparsec: Header data DNSHeader = DNSHeader { hid :: !Word16, hflags :: !Word16, hnumQuestions :: !Word16, ...
DavSanchez's user avatar
2 votes
1 answer
227 views

I'm currently encountering a problem while translating a parser from a CFG-based tool (antlr) to Megaparsec. The grammar contains lists of expressions (handled with makeExprParser) that are enclosed ...
user1512263's user avatar
2 votes
2 answers
113 views

I want to parse strings like "0-9" into ('0', '9') but I think my two attempts look a bit clumsy. numRange :: Parser (Char, Char) numRange = (,) <$> digitChar <* char '-' <*> ...
Good Night Nerd Pride's user avatar
1 vote
1 answer
501 views

I'm trying to parse the following input using megaparsec (if this sounds familiar to the advent of code challenge from day 7 2022, it's because it is): $ cd / $ ls dir a 123 foo.txt dir d $ cd a $ ls ...
l7r7's user avatar
  • 1,358
0 votes
2 answers
424 views

Currently I have a parser: pScientific :: Parser Scientific pScientific = lexeme L.scientific This is able to easily parse something like 4087.00 but fails when then number 4,087.00 Is there a way to ...
Bads's user avatar
  • 774
0 votes
1 answer
465 views

I am trying to parse (using magaparsec) the XML export of FreePlane (mindmapper). This is my third attempt to really 'learn' (internalize) megaparsec. I've written several parsers before, two worked (...
TomP's user avatar
  • 108
0 votes
1 answer
149 views

Using Megaparsec, if I want to parse a string containing comments of the form ~{content} into a Comment record, how would I go about doing that? For instance: data Comment = { id :: Integer, content ::...
Niek's user avatar
  • 1,648

15 30 50 per page
1
2 3 4 5
7