context-free-grammar Questions

1

As we know, given a regular grammar, we have algorithm to get its regular expression. But if the given grammar is context-free grammar (but it only generates regular language), like S->aAb A->...
Manatarms asked 16/5, 2012 at 2:17

1

Solved

Can anyone outline for me an algorithm that can convert any given regex into an equivalent set of CFG rules? I know how to tackle the elementary stuff such as (a|b)*: S -> a A S -> a B S -&...
Farrington asked 30/10, 2012 at 13:15

2

Solved

I see umpteen posts a day about "how to do X with regexen". And the best response to most of them seems like it would honestly be, "Why are you trying to drive a screw with a hammer?" But regexen a...
Hoffmann asked 18/9, 2012 at 19:57

2

Solved

I have to implement horizontal markovization (NLP concept) and I'm having a little trouble understanding what the trees will look like. I've been reading the Klein and Manning paper, but they don't...
Voorhees asked 14/10, 2012 at 16:54

2

Solved

I'm learning the difference between the lemmata in the question. Every reference I can find uses the example: {(a^i)(b^j)(c^k)(d^l) : i = 0 or j = k = l} to show the difference between the two. ...
Hagridden asked 27/9, 2012 at 2:6

1

Solved

I'm using Jison (Bison) to create a simple markup language. I'm clearly new to this, but slight variations are working very well. I just don't understand the source of the S/R conflict. It doesn't...
Appoggiatura asked 3/10, 2012 at 20:1

3

Can someone explain to me why grammars [context-free grammar and context-sensitive grammar] of this kind accepts a String? What I know is Context-free grammar is a formal grammar in which every ...

2

Solved

So I've been trying to write a calculator with Scala's parser, and it's been fun, except that I found that operator associativity is backwards, and that when I try to make my grammar left-recursive...
Micromillimeter asked 3/6, 2012 at 17:19

3

Solved

Recently I've discovered the python module pyparsing, a wonderful tool for parsing data by writing the grammar, not the parser. I'm new to the idea of context-free grammars, so please correct any f...
Epiphenomenon asked 5/4, 2012 at 14:27

2

Solved

I'd really love your help with this deciding whether the language of all words over the alphabet {0,1} that can't be read from both sides the same way, { w | w <> wR }, is a context-free languag...
Upkeep asked 27/3, 2012 at 8:27

1

Solved

Reading Chomsky hierarchy ... ... I know regexp can't parse type-2 grammars (context-free grammars), and also type-1 and type-0. Can regular expressions parse/catch ALL type-3 grammars (regular gra...

2

Solved

I have to determine whether a language (for example L={a^n b^m c^s | 0<=n<=m<=s}) is regular, context-free, recursive, recursively enumerable or none of them. I know how to determine if a...

2

Solved

I'm trying to learn Parsec by implementing a small regular expression parser. In BNF, my grammar looks something like: EXP : EXP * | LIT EXP | LIT I've tried to implement this in Haskell as: ...
Haff asked 26/1, 2012 at 15:11

1

Solved

I have this regular expression: regex = %r{\A(?<foo> a\g<foo>a | b\g<foo>b | c)\Z}x When I test it against several strings, it appears to be as powerful as a context free gramm...
Exuberance asked 22/1, 2012 at 5:49

3

Solved

I am learning context-free grammar, and I don't understand how to identity expression, factor and term in a programming language like C or C++. Suppose we have an assignment statement, id := E, wh...
Eject asked 8/11, 2011 at 18:51

7

Solved

I've posted this on the D newsgroup some months ago, but for some reason, the answer never really convinced me, so I thought I'd ask it here. The grammar of D is apparently context-free. The gramm...
Granthem asked 8/8, 2011 at 13:4

2

Solved

I'm studying context free grammar and I'm curious what the arrow with the star and the arrow without the star mean in parts f and g where: f is false. g is true.
Slipon asked 18/10, 2011 at 23:20

3

Solved

How would I find the language for the following regular expressions over the alphabet {a, b}? aUb* (ab*Uc) ab*Ubc* a*bc*Uac EDIT: Before i get downvoted like crazy, i'd appreciate it if someone ...

1

Solved

This was a homework assignment problem which I know I have incorrectly answered. I gave: S -> '' meaning that S yields the empty string. I know that the empty set and empty string are not the...
Katherine asked 26/9, 2011 at 17:14

1

Solved

Consider a short gramma bellow S -> Bc | DB B -> ab | cS D -> d | epsilon The FIRST set is FIRST(S) ={a,c,d} FIRST(B) = { a,c } FIRST(D)= { d, epsilon } in it the Follow(S)={ Follo...
Shawm asked 24/9, 2011 at 13:11

3

Solved

Convert the grammar below into Chomsky Normal Form. Give all the intermediate steps. S -> AB | aB A -> aab|lambda B -> bbA Ok so the first thing I did was add a new start variable S0 s...
Supercharger asked 19/9, 2011 at 0:14

1

Solved

I know there are other tools out there to parse SQL statements, but I am rolling out my own for educational purposes. I am getting stuck with my grammar right now.. If you can spot an error real qu...
Mcdonough asked 8/9, 2011 at 22:57

2

Solved

Can someone explain to me what a context free grammar is? After looking at the Wikipedia entry and then the Wikipedia entry on formal grammar, I am left utterly and totally befuddled. Would someone...
Sweepstakes asked 15/7, 2011 at 21:17

1

Solved

I'm trying to learn how to make a compiler. In order to do so, I read a lot about context-free language. But there are some things I cannot get by myself yet. Since it's my first compiler there a...
Cardinal asked 16/6, 2011 at 23:51

2

I am working on a Dutch corpus and I want to know if NLTK has dutch grammar embedded in it so I can parse my sentences? In general does NLTK only work on English? I know that it has the Alpino dutc...
Paralyse asked 14/2, 2011 at 10:12

© 2022 - 2024 — McMap. All rights reserved.