grammar Questions

1

Solved

Given the following nearley code: @builtin "whitespace.ne" @{% let numberedParams = { 3: 45 }; const lexer = require("moo").compile({ comment: /\(.*?\)/, expstart: /\[/, expend: /\]/, ...
Derwon asked 6/5, 2018 at 20:46

4

Solved

I am wondering if someone has compiled an EBNF for PHP somewhere. I found both this site and this site. Both seem like they are incomplete, though. This question is very similar, but it's a year ol...
Siliqua asked 19/1, 2012 at 18:29

2

Solved

I am writing a parser for a pet project, and for educational purposes, would like to do it by hand instead of using a parser generator. Unfortunately, many online resources (and the compiler course...
Tauto asked 29/7, 2013 at 14:23

1

Solved

Reposted from the #perl6 IRC channel, by jkramer, with permission I'm playing with grammars and trying to parse an ini-style file but somehow Grammar.parse seems to loop forever and use 100% CPU. ...
Artema asked 12/4, 2018 at 15:44

2

Solved

I have a priority problem in my grammar, and I don't have any more idea to fix it. I'm using Lark Here is the thing (I have simplified the problem as much as I can): from lark import Lark parse...
Ursa asked 5/4, 2018 at 11:51

1

Solved

Recently, I experimented with some grammars for modifying small parts of a file. In those test cases, I would keep much of the file as it was, only modifying small pieces here and there, see this ...
Explorer asked 9/3, 2018 at 16:59

2

Solved

can someone clarify when white space is significant in rules in Perl 6 grammars? I am learning some by trial and error, but can't seem to find the actual rules in the documentation. Example 1: ru...
Objection asked 20/2, 2018 at 18:52

1

Solved

I'm working on defining a grammar using ANTLR4 and Java. For Integers, I want a number that mat be preceeded by a minus sign. I know it is possible to do it like this: integer: '-' (DIGIT)* | DIGI...
Jea asked 15/2, 2018 at 14:27

2

Solved

In Chrome 63.0 and Firefox 58.0, it appears that adding an index to an object literal prevents the object from being parsed as an object. {"a":"b"} 17:37:32.246 {a: "b"} {"a":"b"}["a"] 17:37:36.5...
Paternal asked 31/1, 2018 at 17:49

2

Solved

I need help with constructing a left-linear and right-linear grammar for the languages below? a) (0+1)*00(0+1)* b) 0*(1(0+1))* c) (((01+10)*11)*00)* For a) I have the following: Left-linear S -...
Eurythmic asked 11/12, 2012 at 8:38

3

Solved

I am having problems with this mini-grammar, which tries to match markdown-like header constructs. role Like-a-word { regex like-a-word { \S+ } } role Span does Like-a-word { regex span { <l...
Conflagration asked 5/1, 2018 at 9:1

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

1

Solved

Let's say you only want to parse the start of a large file using Perl 6 grammar. In order to avoid reading the whole file into a string, and then call subparse on the string. Is it possible to do a...
Isochroous asked 14/12, 2017 at 16:53

2

Solved

I'm doing Advent of Code day 9: You sit for a while and record part of the stream (your puzzle input). The characters represent groups - sequences that begin with { and end with }. Within a group,...
Domitiladomonic asked 9/12, 2017 at 12:11

2

Solved

I am a newbie in Kotlin. I am curious about the difference of labeled this in Kotlin with prefix @ or postfix @. I have just seen a code which writes SignInActivity@this, which seems to work exact...
Wheelock asked 4/12, 2017 at 4:37

2

Solved

I am trying to parse a BibTeX author field, and split it into its separate authors. This will help me rewriting the initials of each author. Here is a minimal example: use v6; my $str = '{Rockhol...
Faroff asked 12/11, 2017 at 11:36

1

Solved

I am starting to write BibTeX parser. The first thing I would like to do is to parse a braced item. A braced item could be an author field or a title for example. There might be nested braces withi...
Asuncion asked 5/11, 2017 at 17:24

1

Consider the following grammar. I have issues with the operator priority, for instance: res=2*a+b has a similar parse tree as res=2*(a+b). I know where the problem is, but no "beautiful" solution w...
Foliated asked 31/10, 2017 at 9:10

2

Solved

Okay, we all know what the valid left-hand-side expressions are. Kind of.* But, looking at the definition from the ECMA-Script standard, I'm very confused: LeftHandSideExpression : NewExpression...
Stain asked 14/9, 2010 at 14:32

1

Solved

I've watched this course by Alex Aiken and read through many other resources. But I'm struggling to find clear classification of top-down parsers. This document doesn't provide a clear classificati...

1

Solved

In Edit distance: Ignore start/end, I offered a Perl 6 solution to a fuzzy fuzzy matching problem. I had a grammar like this (although maybe I've improved it after Edit #3): grammar NString { reg...
Enunciate asked 24/7, 2017 at 3:37

1

Solved

Imagine a series of complex grammars represented as roles, although this simple example is enough to show the conflict: role Alpha { token alpha { :i <[A..Z]> } } role Digit { token dig...
Metamorphic asked 22/1, 2017 at 13:41

3

Solved

In Mathematica a comment starts with (* and ends with *) and comments can be nested. My current approach of scanning a comment with JFlex contains the following code %xstate IN_COMMENT "(*" { yyp...
Stump asked 10/7, 2014 at 2:44

1

Solved

The lexical grammar of most programming languages is fairly non-expressive in order to quickly lex it. I'm not sure what category Rust's lexical grammar belongs to. Most of it seems regular, probab...
Exsiccate asked 28/4, 2017 at 10:9

1

Solved

Sorry in advance; I am sure this question will seem almost idiotic to people who are used to playing with parsers and grammars, but these are foreign topics to me, and this is my attempt at steppin...
Revenuer asked 11/4, 2017 at 15:5

© 2022 - 2024 — McMap. All rights reserved.