LL(k) grammars are grammars that can be parsed from left-to-right, creating a leftmost derivation, using k tokens of lookahead.
Questions tagged [ll-grammar]
209 questions
0
votes
1 answer
From article on Wikipedia, is this a LL(0) grammar?
I am studying LL/LR parses and while reading the LL parser page on Wikipedia, I found this grammar:
S → F
S → ( S + F )
F → a
From the article it is LL (LL(0) I assume from the table); but I found a proof which states that an LL(0) parser has no…

N3sh
- 881
- 8
- 37
0
votes
1 answer
Antlr: ignore keywords in specific context
I'm constructing an English-like domain specific language with ANTLR. Its keywords are context-sensitive. (I know it sounds dirty, but it makes a lot of sense for the non-programmer target users.) For example, the usual logical operators such as or…

Dylan Knowles
- 2,726
- 1
- 26
- 52
0
votes
1 answer
Can an LL(1) parse table be valid if there is a column with no entries in its cells?
I'm doing exam questions for revision for an exam. One of the questions is to construct an LL(1) parse table from the first and follow sets calculated in the previous question.
Now I am nearly positive that I have constructed the first and follow…

Ian
- 1,490
- 6
- 24
- 39
0
votes
1 answer
Explanation on this FIRST function
LL(1) Grammar:
(1) Var -> ID DimList
(2) DimList -> ε DimList'
(3) DimList' -> Dim DimList'
(4) DimList' -> ε
(5) Dim -> [ CONST ]
And, in the script that I am reading, it says that the function FIRST(ε DimList') gives {#, [}. But, how?
My…

TedK.
- 125
- 1
- 9
0
votes
1 answer
Recognising LL and LR grammars... NOT parser
If I am given a CFG by looking at it can I decide whether it is a LL class of grammar or LR class of grammar? When I searched for this question on Google what I got was how the parsers for these grammars work, but, that is not what I want. Any…

Anurag Banerjee
- 19
- 1
0
votes
1 answer
Explanations about FOLLOW function - Grammar
I've some problems to understand the function FOLLOW. I cannot calcule follow functions of a grammar and that's not good. I tried exercises to understand this function and in particulary this exercise, I've this grammar :
S -> E
E -> T E'
E' -> + T…

afk
- 563
- 2
- 5
- 12
0
votes
3 answers
LL(1) Parsing -- First(A) with Recursive First Alternatives
How would I apply the FIRST() rule on a production such as :
A -> AAb | Ab | s
where A is a non-terminal, and b,s are terminals.
FIRST(A) of alternatives 1 & 2 would be A again, but such would end in infinite applications of FIRST, since I need a…

FinalFortune
- 635
- 10
- 25
0
votes
1 answer
Grammars && LL Parsers
So I have a homework assignment and I've spent over 2hrs trying to find out why this grammar will not work with a LL parser:
→ a
→ a b
→ b d
→ d
→ m n
→ x y
Could someone please point me in the right…

Sunny Patel
- 578
- 6
- 9
-1
votes
1 answer
Why am I getting different results from the Dragon Book when constructing LL(1) table?
Page 224, Algorithm 4.31.
The method for constructing an LL(1) table says:
For each production A -> alpha of the grammar, do the following.
For each terminal a in FIRST(A), add A -> alpha to M[A, a].
If eps is in FIRST(alpha), then for each…

Lazar Ljubenović
- 18,976
- 10
- 56
- 91
-1
votes
4 answers
Writing manual parser
I need write a parser manually. Can`t choose between LL(*) and LR (maybe try Earley?). Should I use bottom-up parsing, because grammar for LL will be rather difficult?

mystdeim
- 4,802
- 11
- 49
- 77
-1
votes
1 answer
How to find the follow of the following grammar
Grammar
S->(A)
A->CB
B->;A|ε
C->x|S
I have find the First of the grammar:
First(S)={(}
First(B)={;,ε}
First(C)={x,(}
First(A)=First(C)={x,(}
I have trouble finding the Follow of the grammar.

Nauman Ahmad
- 320
- 4
- 17
-1
votes
1 answer
A Grammar And some challenge about SLR, LALR
I know:
A language is said to be LL(1) if it can be generated by a LL(1) grammar. It can be shown that LL(1) grammars are
not ambiguous and
not left-recursive.
but i ran into a problem.
Why the Grammar
S-> aBDb
B -> lambda
D-> dD |…
user3929084
-3
votes
1 answer
Solve this using predicitive parser LL1 parser
Solve this question using predicitive parser LL1 parser
E-> E O E | (E) | id
O -> + /- / % /

user1448612
- 25
- 2
- 3