Path: utzoo!attcan!uunet!world!esegue!compilers-sender From: hankd@dynamo.ecn.purdue.edu (Hank Dietz) Newsgroups: comp.compilers Subject: Re: Can Pascal be parsed by LR(1) parsing algorithm? Summary: It should be LL(1)... Keywords: pascal, parse Message-ID: <9010101445.AA06181@dynamo.ecn.purdue.edu> Date: 10 Oct 90 17:16:40 GMT References: <9010091533.AA02386@apple.com> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: hankd@dynamo.ecn.purdue.edu (Hank Dietz) Organization: Purdue University Engineering Computer Network Lines: 22 Approved: compilers@esegue.segue.boston.ma.us In article <9010091533.AA02386@apple.com> A. Michael Burbidge writes: >After struggling for some time to write a yacc description for the >Pascal language and after reading the description of the modifier yacc >contained in the UCB Pascal source directory I am beginning to wonder >if an LR(1) parsing algorithm can parse Pascal. ... Pascal is generally defined using a set of syntax diagrams which, by definition, means the language can be recognized using LL(1). This does not mean, however, that a particular Pascal dialect is LR(1); there may be extensions or error handling states, etc., which cause the language to not be LR(1). Also, YACC builds LALR(1) parsers, not LR(1). I vaguely recall one of Johnson's own papers saying something about a YACC-generated parser not being able to parse YACC input because YACC input is LALR(2)... so I'm not so sure that LALR(1) is equivalent to LALR(k). Or perhaps the "convolutions" are VERY "unpleasant"? -hankd@ecn.purdue.edu -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.