peg Questions

1

First... Would it be possible to accomplish simple syntax highlighting using a PEG. I'm only looking for it to be able to recognize and highlight basic things that are common to c style languages ...
Pyrophosphate asked 8/10, 2013 at 18:42

3

Solved

From this wikipedia page: The fundamental difference between context-free grammars and parsing expression grammars is that the PEG's choice operator is ordered. If the first alternative succ...
Collimator asked 31/3, 2011 at 13:59

2

Solved

I'm playing around with PEG.js start = keyword keyword = a:[a-z]? {return a.join("");} Why am I getting here the error: a.join is not a function when I enter a valid string like abc?
Hostess asked 31/10, 2015 at 11:30

1

Solved

I was going through the python grammer specification and find the following statement for_stmt: | 'for' star_targets 'in' ~ star_expressions ':' [TYPE_COMMENT] block [else_block] What does ~ mea...
Individuation asked 8/9, 2021 at 6:5

1

So I am playing with lpeg to replace a boost spirit grammar, I must say boost::spirit is far more elegant and natural than lpeg. However it is a bitch to work with due to the constraints of current...
Sodality asked 1/11, 2011 at 15:20

1

Solved

I have recently come across PEG parsers, and Guido van Rossum's article on PEG parsers and how to construct them. That article talks about "PEG" parsers but internally it looks exactly li...
Voidable asked 3/12, 2019 at 12:36

2

Solved

I have essentially the same question as PEG for Python style indentation, but I'd like to get a little more direction regarding this answer. The answer successfully generates an array of strings t...
Corr asked 25/7, 2012 at 21:43

2

Solved

How do you build an AST (Abstract Syntax Tree) for left-associative operators using PEG.js? I've tried to write some code based on the information I found on the internet, but I seem to have made ...
Gerdy asked 12/6, 2014 at 0:22

1

Solved

I'm still fighting with ambiguous grammar of Qt's qmake. Now I can't find a way to describe function arguments that can contain parenthesis (e.g. regex): functionName(arg1, "arg2", ^(arg3)+$) I...
Yaakov asked 21/12, 2017 at 5:47

3

Solved

I'm trying to create some kind of lint tool for the C/AL programming language. So basically I need to perform syntax and lexical analysis against the source code. I've planned to write parser from ...
Interventionist asked 1/8, 2012 at 11:51

3

I'm trying to wrap my head around PEG by entering simple grammars into the PEG.js playground. Example 1: Input: "abcdef1234567ghijklmn8901opqrs" Desired output: ["abcdef", "1234567", "ghijklmn"...
Hawfinch asked 31/8, 2010 at 20:12

1

Solved

This is a demo code label: var id let id = 10 goto label If allowed keyword as identifier will be let: var var let var = 10 goto let This is totally legal code. But it seems very hard to do t...
Jemine asked 2/1, 2017 at 5:13

1

Solved

I'm trying to catch some text between parathesis with a semicolon in the end. Example: (in here there can be 'anything' !"#¤);); any character is possible); I've tried this: Text = "(" text:(.*...
Dwarfism asked 20/9, 2016 at 21:44

3

(Note: I've read other questions like this, but I haven't been able to figure this out). I wrote this grammar: start = call ident = [a-z]+ spaces = [ ]+ call = f:ident spaces g:(call / ident) {...
Wrapping asked 19/11, 2012 at 15:1

5

Solved

How would you write a Parsing Expression Grammar in any of the following Parser Generators (PEG.js, Citrus, Treetop) which can handle Python/Haskell/CoffeScript style indentation: Examples of a no...
Narvaez asked 17/11, 2010 at 14:35

2

Solved

In a normal PEG (parsing expression grammar) this is a valid grammar: values <- number (comma values)* number <- [0-9]+ comma <- ',' However, if I try to write this using LPeg the recur...
Reiff asked 1/10, 2014 at 20:15

1

Solved

I need to parse expressions based on following rules: An expression can contain a filter object represented as name:value An expression can contain a string expression An expression can contain B...
Lafrance asked 26/11, 2015 at 10:25

1

Solved

The POSIX shell command language is not easy to parse, largely because of tight coupling between lexing and parsing. However, parsing expression grammars (PEGs) are often scannerless. By combining...
Matrilateral asked 9/3, 2015 at 2:58

1

Solved

I've been trying to work out the basic skeleton for a language I've been designing, and I'm attempting to use Parsimonious to do the parsing for me. As of right now, I've, declared the following gr...
Marrakech asked 29/10, 2015 at 15:10

2

Solved

I've seen some claims that optimized PEG parsers in general cannot be faster than optimized LALR(1) or LL(k) parsers. (Of course, performance of parsing would depend on a particular grammar.) I'd ...
Gnu asked 7/7, 2012 at 8:54

2

Solved

I've just started playing with PEG.js and have a problem with a grammar (vastly simplified for debugging): start = presingle single / preplural plural presingle = "a" / "b" preplural = "b" ...
Hydrazine asked 31/10, 2012 at 14:32

2

Solved

I'm trying to extend the example grammar of PEG.js for parsing mathematical expressions with all the 4 operators for my online BASIC interpreter experiment: http://www.dantonag.it/basicjs/basicjs....
Peeper asked 15/10, 2013 at 20:7

1

Solved

I was wondering how do you parse comments (say, a la Haskell), in pegjs. The goal: {- This is a comment and should parse. Comments start with {- and end with -}. If you've noticed, I still inc...
Radioisotope asked 9/2, 2015 at 21:44

2

Solved

I'm wondering if it's possible to use a CFG or PEG grammar as a basis for code completion directly without modification. I have heard that code completion is in IDE's is sometimes manipulated and m...

2

Solved

Implementing a peg.js based parser, I get stuck adding code to to handle c-style comments /* like this */. I need to find the end marker without eating it. this not working: multi = '/*' .* '*/'...
Nonunion asked 24/10, 2014 at 21:30

© 2022 - 2024 — McMap. All rights reserved.