How change grammar to equivalent LL(1) ?

Andy <borucki.andrzej@gmail.com>
Sun, 22 Dec 2019 15:55:12 -0800 (PST)

          From comp.compilers

Related articles
How change grammar to equivalent LL(1) ? borucki.andrzej@gmail.com (Andy) (2019-12-22)
Re: How change grammar to equivalent LL(1) ? lhp+news@toft-hp.dk (Lasse =?iso-8859-1?q?Hiller=F8e?= Petersen) (2019-12-23)
Re: How change grammar to equivalent LL(1) ? christopher.f.clark@compiler-resources.com (Christopher F Clark) (2019-12-23)
Re: How change grammar to equivalent LL(1) ? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2019-12-23)
Re: How change grammar to equivalent LL(1) ? lhp+news@toft-hp.dk (Lasse =?iso-8859-1?q?Hiller=F8e?= Petersen) (2020-04-24)
Re: How change grammar to equivalent LL(1) ? 773-297-7223@kylheku.com (Kaz Kylheku) (2020-04-24)
| List of all articles for this month |

From: Andy <borucki.andrzej@gmail.com>
Newsgroups: comp.compilers
Date: Sun, 22 Dec 2019 15:55:12 -0800 (PST)
Organization: Compilers Central
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

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]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.