parser-combinators Questions

2

Solved

I have a working parser, but I've just realised I do not cater for comments. In the DSL I am parsing, comments start with a ; character. If a ; is encountered, the rest of the line is ignored (not ...
Dnieper asked 4/1, 2014 at 19:7

1

Solved

I am trying to build a small parser where the tokens (luckily) never contain whitespace. Whitespace (spaces, tabs and newlines) are essentially token delimeters (apart from cases where there are br...
Maneater asked 27/12, 2013 at 0:21

1

Solved

I'm using Trifecta parser combinator library and my parser outputs instances of AST data type. I want each instance to have unique ID (which is simple Int). In Parsec I would create custom state a...
Veneaux asked 14/9, 2013 at 21:30

1

Solved

Question Is it somehow possible to create an extractor for shapeless' HList that looks like the following. val a ~ _ ~ b = 4 :: "so" :: 4.5 :: HNil => a == 4 && b == 4.5 Repl...
Aquila asked 27/8, 2013 at 14:42

3

Solved

Lets see the code snippet: pSegmentBegin p i = pIndentExact i *> ((:) <$> p i <*> ((pEOL *> pSegment p i) <|> pure [])) if I change this code in my parser to: pSegmentBe...
Beater asked 16/8, 2013 at 13:59

2

Solved

I'm using uu-parsinglib, but I think the following question is parser combinator generic. Let's consider the following example: I've got a lexer with a combinator pLex, which produces a list of t...
Osteotomy asked 13/8, 2013 at 16:17

2

Solved

I would like to implement a parser for some defined language using Scala Parser Combinators. However, the software that will compile the language does not implements all the language's feature, so ...
Birdhouse asked 3/7, 2013 at 12:33

1

The only ways I am aware of, aren't "direct": converting to ANTLR format and using its own visualizer VISUALLANGLAB, which it seems to require an entire mouse-clicks "rewrite" implementing a conv...
Evannia asked 30/1, 2013 at 18:41

1

Solved

I'm a beginner in scala, working on S99 to try to learn scala. One of the problems involves converting from a string to a tree data structure. I can do it "manually", by I also want to see how to d...
Twomey asked 27/12, 2012 at 23:25

2

Solved

Is there a convenient way to use Scala's parser combinators to parse languages where indentation is significant? (e.g. Python)
Harbison asked 20/11, 2012 at 4:44

1

I have written a parser as follows: class LogParser extends JavaTokenParsers { def invertedIndex: Parser[Array[Array[(Int, Int)]]] = { num ~> num ~> num ~> rep(postingsList) ^^ { _.to...
Grados asked 3/11, 2012 at 21:24

1

Solved

I am writing a Scala parser combinator grammar that reads newline-delimited word lists, where lists are separated by one or more blank lines. Given the following string: cat mouse horse apple ora...
Whiting asked 13/11, 2012 at 3:35

1

Solved

Is it possible to invert matches with Scala parser combinators? I am trying to match lines with a parser that do not start with a set of keywords. I could do this with an annoying zero width negati...
Octangle asked 31/10, 2012 at 19:15

1

Solved

What is the best way to (efficiently) parse C-style multi-line comments (i.e., /* ... */) with Scala parser combinators? In a project that I'm involved in we parse a C-like programming language, a...
Juggler asked 6/10, 2012 at 23:54

1

Solved

I'm experimenting with Trifecta for parsing a very simple functional language with Haskell-like layout syntax. I'm working off the Haddock docs and my experience with Parsec, because I couldn't fin...
Backwoodsman asked 11/9, 2012 at 14:34

1

Solved

I am working on a Parsing logic that needs to take operator precedence into consideration. My needs are not too complex. To start with I need multiplication and division to take higher precedence t...
Missie asked 18/7, 2012 at 2:36

3

Solved

I read the tutorial on parser combinators for Scala, and I was wondering if there's something as "magical" for Java. The best thing I could find was JParsec.
Extravehicular asked 9/3, 2011 at 10:38

2

Solved

I am little bit confusing about ">>" in scala. Daniel said in Scala parser combinators parsing xml? that it could be used to parameterize the parser base on result from previous parser. Could someo...
Streit asked 2/11, 2011 at 10:55

2

Solved

I am familiar with some of the basics of fparsec but it seems to be geared towards text files or streams. Are there any other F# library's that can efficiently parse binary files? Or can fparsec b...
Raviv asked 17/10, 2011 at 22:57

2

Solved

I have a list of values from which I can construct a list of parsers, that depend on these values by mapping (see example). Then what I want to do is turn the list of parsers into a single parser b...
Imogen asked 8/10, 2011 at 21:19

3

Solved

I'm fairly new to Scala and while reading about parser combinators(The Magic Behind Parser Combinators, Domain-Specific Languages in Scala) I came across method definitions like this: def classPre...
Bordello asked 25/7, 2011 at 15:23

1

Solved

Consider this part of the grammar: def expression = SimpleExpression ~ opt(relation ~ SimpleExpression) def relation = "=" | "#" | "<=" | "<" | ">=" | ">" | "IN" | "IS" def SimpleEx...

2

Solved

How can parsers be used to parse records that spans multiple lines? I need to parse tree data (and eventually transform it to a tree data structure). I'm getting a difficult-to-trace parse error in...
Neigh asked 30/5, 2011 at 20:44

1

Solved

I'm trying to create a language, and there are some parts of it that I want to be case insensitive. I'm sure this is something easy, but I haven't been able to find it. Edit: Re-reading makes me ...
Unify asked 21/5, 2011 at 8:2

1

Solved

What is the most simple way to make my parser respect (ignore) C-style comments. I'm interested in both comment types, though a solution for only one type is also welcome. I'm currently simply ext...
Tecumseh asked 10/5, 2011 at 15:42

© 2022 - 2024 — McMap. All rights reserved.