Top "Context-free-grammar" questions

In formal language theory, a context-free grammar (CFG) is a grammar subject to a special constraint: that the left-hand side (LHS) consist of a single non-terminal symbol.

How to find FIRST and FOLLOW sets of a recursive grammar?

Suppose I have the following CFG. A -> B | Cx | EPSILON B -> C | yA C -> …

compiler-construction context-free-grammar
Tool for drawing parse trees?

Does anyone have a good tool for drawing parse trees arising from a context-free grammar? There is this question, but …

graphviz context-free-grammar parse-tree
How is this grammar LR(1) but not SLR(1)?

I have the following grammar, which I'm told is LR(1) but not SLR(1): S ::= a A | b A c | d …

parsing grammar conflict context-free-grammar lr
How can I construct a grammar that generates this language?

I'm studying for a finite automata & grammars test and I'm stuck with this question: Construct a grammar that generates …

grammar context-free-grammar automata
NLTK Context Free Grammar Genaration

I'm working on a non-English parser with Unicode characters. For that, I decided to use NLTK. But it requires a …

python parsing nlp nltk context-free-grammar
Why is bottom-up parsing more common than top-down parsing?

It seems that recursive-descent parsers are not only the simplest to explain, but also the simplest to design and maintain. …

parsing context-free-grammar
Is the complement of any context free language context free?

I read multiple answers that state if a language is not context free, then its complement is context free (correct …

complexity-theory context-free-grammar formal-languages context-free-language
Formal Context Free Grammar From Context Free Language

How can a formal context free grammar be generated for the following language: {ai bjck | i != j or j != k} …

context-free-grammar automata
Grammar to Regular Expression

Which is the procedure steps to find the regular expression that accept the same language of a given Grammar? S …

context-free-grammar regular-language left-recursion automata-theory
A grammar that accepts the empty set by the rule S->S

This was a homework assignment problem which I know I have incorrectly answered. I gave: S -> '' meaning …

grammar context-free-grammar