context-free-grammar Questions

9

Solved

I'm studying for a finite automata & grammars test and I'm stuck with this question: Construct a grammar that generates L: L = {a^n b^m c^m+n|n>=0, m>=0} I believe my productions shoul...
Geaghan asked 20/6, 2009 at 15:48

1

Solved

I'm getting back into language design/specification (via BNF/EBNF grammars) after 20+ years of leaving the topic alone (since my CS undergrad degree). I only vaguely recall the various related term...
Tamworth asked 14/12, 2022 at 23:40

5

Solved

Are there any tools to convert ANTLR grammar syntax to and from other BNF syntaxes? There are several forms Backus-Naur Form (BNF, EBNF, ABNF, W3C-BNF, XBNF...) with specification, e.g. see t...
Perturb asked 1/2, 2011 at 22:52

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

According to the ECMAScript spec: There are several situations where the identification of lexical input elements is sensitive to the syntactic grammar context that is consuming the input elements...

2

Solved

I am reading Rebol Wikipedia page. "Parse expressions are written in the parse dialect, which, like the do dialect, is an expression-oriented sublanguage of the data exchange dialect. Unlike ...
Rase asked 12/9, 2019 at 14:13

5

Solved

I'm working on a non-English parser with Unicode characters. For that, I decided to use NLTK. But it requires a predefined context-free grammar as below: S -> NP VP VP -> V NP | V NP PP ...
Hermelindahermeneutic asked 17/7, 2013 at 9:6

1

Solved

This might be related to me not understanding the Keyword Extraction feature, which from the docs seems to be about avoiding an issue where no space exists between a keyword and the following expre...
Garnetgarnett asked 21/3, 2021 at 14:36

9

Solved

Or, to be a little more precise: which programming languages are defined by a context-free grammar? From what I gather C++ is not context-free due to things like macros and templates. My gut tells...
Millhon asked 22/5, 2009 at 15:31

3

Solved

NLTK (Natural Language Toolkit) lets you parse a FCFG grammar using nltk.FCFG.fromstring([grammar string here]). Where is the FCFG grammar format specification*? I googled it to death, but all I co...
Scrubber asked 12/3, 2016 at 21:10

3

Does anyone have a good tool for drawing parse trees arising from a context-free grammar? There is this question, but it dealt specifically with finite automata instead of parse trees. I've b...
Barbarian asked 11/2, 2011 at 18:16

2

Solved

When looking through C's BNF grammar, I thought it was weird that the production rule for a declaration looked like this (according to https://cs.wmich.edu/~gupta/teaching/cs4850/sumII06/The%20synt...
Beanstalk asked 4/4, 2020 at 9:50

2

I am currently going over CFG and saw the answer and I am not sure how they got it. How did they get it to convert into Regular Expression from CFG here? S -> aS|bX|a X -> aX|bY|a Y -> aY...
Demythologize asked 10/4, 2014 at 17:1

20

Solved

I often hear claims that C++ is a context-sensitive language. Take the following example: a b(c); Is this a variable definition or a function declaration? That depends on the meaning of the symb...

3

Solved

I understand that EBNF can be used to express Context Free Grammar, but is there any difference between the two? I am asking because there are questions that ask to convert EBNF to CFG, but as of ...
Cheliform asked 1/2, 2014 at 0:36

4

I have the following grammar, which I'm told is LR(1) but not SLR(1): S ::= a A | b A c | d c | b d a A ::= d I don't understand why this is. How would you prove this?

3

Solved

How can I find if an attribute is synthesized or inherited from the productions of a grammar? I guess for that the attribute must be predefined in the problem -- if its value depends on child or p...

1

Solved

Many productions in EcmaScript are given with the following "modifiers": [Yield, Await, In, Return] Here are a few examples: ArrayLiteral[Yield, Await]: ... ElementList[Yield, Await]: ... As...

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

According to "Recursive descent parser" on Wikipedia, recursive descent without backtracking (a.k.a. predictive parsing) is only possible for LL(k) grammars. Elsewhere, I have read that the implem...
Autocephalous asked 21/8, 2017 at 12:2

1

I have to check if a string can be derived from a given context free that is in Chomsky normal form. I'm using C++. There is very nice pseudocode on the Wikipedia article covering the CYK algorith...
Acquiescence asked 5/12, 2012 at 17:7

4

Solved

A C program source code can be parsed according to the C grammar(described in CFG) and eventually turned into many ASTs. I am considering if such tool exists: it can do the reverse thing by firstly...
Schenk asked 17/12, 2010 at 5:54

3

Solved

I understand both LR and LALR are bottom-up parsing algorithms, but what's the difference between the two? What's the difference between LR(0), LALR(1), and LR(1) parsing? How can I tell if ...

2

I want to design a context free grammar for the following language: L = { w e {(, )}* | w is balanced} I proposed the following grammar: S -> (S)S | E Whereas the proposed solution in the...
Beheld asked 24/2, 2017 at 3:14

5

Solved

I need a CFG which will generate strings other than palindromes. The solution has been provided and is as below.(Introduction to theory of computation - Sipser) R -> XRX | S S -> aTb | bTa T...
Earthiness asked 27/6, 2011 at 15:23

© 2022 - 2024 — McMap. All rights reserved.