Re: A minimal LL(1) parser generator ?

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Tue, 31 Dec 2019 16:30:08 GMT

          From comp.compilers

Related articles
A minimal LL(1) parser generator ? borucki.andrzej@gmail.com (Andy) (2019-12-21)
Re: A minimal LL(1) parser generator ? arnold@skeeve.com (2019-12-22)
Re: A minimal LL(1) parser generator ? anton@mips.complang.tuwien.ac.at (2019-12-26)
Re: A minimal LL(1) parser generator ? carlglassberg@gmail.com (2019-12-29)
Re: A minimal LL(1) parser generator ? gaztoast@gmail.com (2019-12-31)
Re: A minimal LL(1) parser generator ? anton@mips.complang.tuwien.ac.at (2019-12-31)
Re: A minimal LL(1) parser generator ? carlglassberg@gmail.com (2020-01-01)
Re: A minimal LL(1) parser generator ? gaztoast@gmail.com (honey crisis) (2020-01-02)
Re: A minimal LL(1) parser generator ? anton@mips.complang.tuwien.ac.at (2020-01-02)
Re: A minimal LL(1) parser generator ? gneuner2@comcast.net (George Neuner) (2020-01-02)
Re: A minimal LL(1) parser generator ? rockbrentwood@gmail.com (2020-01-04)
Re: A minimal LL(1) parser generator ? gaztoast@gmail.com (honey crisis) (2020-01-05)
[8 later articles]
| List of all articles for this month |
From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Tue, 31 Dec 2019 16:30:08 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 19-12-016 19-12-030 19-12-032
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="12470"; mail-complaints-to="abuse@iecc.com"
Keywords: LL(1), parse
Posted-Date: 31 Dec 2019 11:42:49 EST

carlglassberg@gmail.com writes:
>Gray's meta notation uses a postix operator "&&" for "separator list".
>
>"&&" seems particularly elegant and interesting:
>
>If Gray: "a b &&" ---> EBNF: "a { b a }"
>
>then I assume:
>
>"a b && c &&" ---> "a { b a } { c a }"


The left operand of the second && would be "a b &&", so the whole
thing would be equivalent to


a {b a} {c {a {b a}}}


a (( b || c )) &&


would parse the same strings, but with different parse trees; so if
you add actions, the results would probably be different.


>and so on ...
>
>Further "a b && b && ..." ===> "a b &&"


They describe the same strings, yes. However, the former has an
ambiguous grammar that allows to parse "aba" in two ways: either the b
is the first b or the second one. In Gray, this leads to a conflict
(it just can deal with LL(1) grammars), and I guess one of these
parsing options never be exercised, which means that it works as if
you had written "a b &&" in the first place.


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/


Post a followup to this message

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