Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: A minimal LL(1) parser generator ? Date: Tue, 31 Dec 2019 16:30:08 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Lines: 37 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <19-12-040@comp.compilers> References: <19-12-016@comp.compilers> <19-12-030@comp.compilers> <19-12-032@comp.compilers> 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 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:2420 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/