Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2400

How change grammar to equivalent LL(1) ?

Path csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!178.20.174.218.MISMATCH!feeder5.feed.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From Andy <borucki.andrzej@gmail.com>
Newsgroups comp.compilers
Subject How change grammar to equivalent LL(1) ?
Date Sun, 22 Dec 2019 15:55:12 -0800 (PST)
Organization Compilers Central
Lines 17
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <19-12-019@comp.compilers> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="47742"; mail-complaints-to="abuse@iecc.com"
Keywords LL(1), comment
Posted-Date 22 Dec 2019 19:06:42 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:2400

Show key headers only | View raw


Obviously if is possible.
In Polish Wikipedia can we read, that even very simple grammar:
expr->number '+' expr
expr->number
is not LL(1) bacause we must see '+' to distinguish

But
is posssible equivalent grammar:
expr -> number optPlusExpr
optPlusExpr -> epsilon
optPlusExpr ->'+' expr

What are general rules to change grammar to equivalent LL(1) grammar if possible?
[This topic is covered in every compiler textbooks.  Or you can start
with this Wikipedia article
https://en.wikipedia.org/wiki/Left_recursion#Removing_left_recursion
-John]

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

How change grammar to equivalent LL(1) ? Andy <borucki.andrzej@gmail.com> - 2019-12-22 15:55 -0800
  Re: How change grammar to equivalent LL(1) ? Lasse Hillerøe Petersen <lhp+news@toft-hp.dk> - 2019-12-23 03:17 +0000
  Re: How change grammar to equivalent LL(1) ? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-12-23 10:01 +0100

csiph-web