Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!spdcc!ima!esegue!johnl From: johnl@esegue.segue.boston.ma.us (John R. Levine) Newsgroups: comp.lang.misc Subject: Re: PL/I Grammar Keywords: PL/I, C, grammar, parser Message-ID: <1989Oct18.012237.548@esegue.segue.boston.ma.us> Date: 18 Oct 89 01:22:37 GMT References: <2956@usceast.UUCP> Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine) Organization: Segue Software, Cambridge MA Lines: 24 In article <2956@usceast.UUCP> sharp@usceast.UUCP (Harry Sharp) writes: > I am attempting to locate a copy of a PL/I or PL/C grammar to use >in creating a PL/I to C translator. This is a part of my Master's thesis. >Does such a beast exist? I have been told that PL/I cannot be parsed LALR. >Is this true? (I hope not.) PL/I has no reserved words, which makes it pretty exciting to parse using context-free methods. You can, for example, call a variable READ or DECLARE. Once you deal with that problem (by prescanning statements) the grammar is supposed to be context free and yacc could probably handle it. The ANSI PL/I standard has a BNF concrete syntax that is about 15 pages of single-spaced text. That's probably as good a place to start as any. The semantics are messy, too. Consider: A = B = C; which compares B and C and sets A to '1'B if they are equal. This is no problem for yacc to handle, but it's a pain for humans. What a language. -- John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650 johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl Massachusetts has over 100,000 unlicensed drivers. -The Globe