parser-combinators Questions

6

Solved

I am writing an expression parser for an app written mostly in Scala. I have built AST objects in Scala, and now need to write the parser. I have heard of Scala's built-in parser combinators, and a...
Wormseed asked 15/5, 2011 at 20:46

1

Solved

Consider the usage of these different parser combinators. import Control.Applicative.Combinators import Text.Regex.Applicative main :: IO () main = do let parser1 = sym '"' *> manyTill a...

2

I'm using parsimmon to parse a simple math expression and I'm failing to parse a simple math expression that follows order of operation (i.e. */ has higher precedence than +-). Even if you are not...
Sterile asked 28/12, 2019 at 7:5

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

2

Solved

Consider this parser that converts digit strings to ints: let toInt (s:string) = match Int32.TryParse(s) with | (true, n) -> preturn n | _ -> fail "Number must be below 2147483648" let ...
Bora asked 24/5, 2019 at 22:56

1

Solved

I'm learning nom, and as a test example I'm trying to parse a string until a delimiter. If my delimiter is /, then I want to match everything until that delimiter. For that, a parser like this work...
Medullated asked 2/1, 2019 at 16:13

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...

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

2

I am parsing a small declarative language where in a scope you can have variables declared (with a type), and then later on, just like in most other languages, the name (without the type) is used. ...
Pathan asked 2/1, 2014 at 14:38

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

3

Solved

Consider the following toy grammar and parser: (* in EBNF: ap = "a", { "ba" } bp = ap, "bc" *) let ap = sepBy1 (pstring "a") (pstring "b") let bp = ap .>> (pstring "bc") let test = run bp ...
Evaginate asked 12/8, 2017 at 19:5

3

Solved

I am experimenting with parser combinators and I often run into what seems like infinite recursions. Here is the first one I ran into: import util.parsing.combinator.Parsers import util.parsing.in...
Samuelson asked 5/3, 2010 at 15:37

1

I am trying to implement total parsers with Idris, based on this paper. First I tried to implement the more basic recogniser type P: Tok : Type Tok = Char mutual data P : Bool -> Type where ...
Avoirdupois asked 1/12, 2014 at 13:34

4

Solved

I'm writing a simple functional programming language in Scala using the parser-combinators library. The syntax is specified here: https://github.com/hejfelix/Frase/blob/master/src/main/scala/it/vi...
Pelag asked 31/10, 2015 at 10:14

1

Solved

I'm looking to apply a series of nom parsers and return the complete &str that matches. I want to match strings of the form a+bc+. Using the existing chain! macro I can get pretty close: named...
Isidraisidro asked 30/3, 2016 at 5:25

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'm trying to parse a string that can contain escaped characters, here's an example: import qualified Data.Text as T exampleParser :: Parser T.Text exampleParser = T.pack <$> many (char '\\...
Eurypterid asked 9/2, 2016 at 19:42

5

Solved

I'm trying to bootstrap (a subset of) C from scratch, without using extra dependencies (parser generators, libraries, etc.). Also I want to make use of the idea of parser combinators, which is a fa...
Eating asked 4/1, 2013 at 10:27

1

Is there any existing implementation of the GLL algorithm, either in the form of parser combinators (preferred) or as a parser generator for C or C++? My requirements are that the output is ...
Posen asked 17/1, 2014 at 22:3

1

I have a parser that was written using Scala's RegexParsers - link It had some serious performance problems when parsing a grammar which had deeply nested expressions. As such I have created a ver...
Ebsen asked 27/3, 2015 at 12:40

3

Solved

I'm currently looking for a lexer/parser that generates Scala code from a BNF grammar (an ocamlyacc file with precedence and associativity). I'm quite confused since I found almost nothing on how t...
Expedition asked 22/6, 2010 at 14:19

2

Recently I was looking for a decent grammar for arithmetic expressions but found only trivial ones, ignoring pow(..., ...) for example. Then I tried it on my own, but sometimes it didn´t worked as ...
Ophthalmoscope asked 27/4, 2011 at 14:11

3

Solved

I'm trying to write a CSV parser using Scala parser combinators. The grammar is based on RFC4180. I came up with the following code. It almost works, but I cannot get it to correctly separate diffe...
Sturmabteilung asked 21/2, 2011 at 6:34

4

Solved

My question is about the Scala Parsers: Which ones are available (in the Standard library and outside), what's the difference between them, do they share a common API and can different Parsers ...
Iliad asked 12/12, 2010 at 19:24

1

Solved

Can someone explain how and when to use the triple caret ^^^ (vs the double caret ^^) when designing scala parser combinators? And also when / how to use the parser.into() method (>>).
Assassin asked 21/1, 2014 at 13:25

© 2022 - 2024 — McMap. All rights reserved.