Re: LR(n) parsers (Ge' Weijers)
25 Oct 91 10:05:20 GMT

          From comp.compilers

Related articles
[8 earlier articles]
Re: LR(n) parsers mtxinu!angular! (1991-10-18)
Re: LR(n) parsers (Raul Deluth Miller-Rockwell) (1991-10-19)
Re: LR(n) parsers (Thomas Schoebel) (1991-10-19)
Re: LR(n) parsers (1991-10-22)
Re: LR(n) parsers (Thomas Schoebel) (1991-10-24)
Re: LR(n) parsers sankar@Neon.Stanford.EDU (Sriram Sankar) (1991-10-24)
Re: LR(n) parsers (1991-10-25)
Re: LR(n) parsers (Thomas Schoebel) (1991-10-25)
Re: LR(n) parsers (1991-11-06)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Ge' Weijers)
Keywords: parse, algol68
Organization: Compilers Central
References: 91-10-036 91-10-045
Date: 25 Oct 91 10:05:20 GMT (Dr A. N. Walker) writes:

>In article 91-10-036 Steve Boswell <> writes:
>[re hard to parse aspects of Algol68]
> b) Both "BEGIN lots of grunge END" and "IF lots of grunge THEN ...."
> may be abbreviated to "( lots of grunge ..." except that "END"
> will be abbreviated to ")" and "THEN" to "|". This can't be
> disambiguated until you get to the ")" or "|", and "lots of grunge"
> may include arbitrarily many declarations and statements.

> On the other hand, all of these ambiguities are "easily" resolved
>in a multi-pass compiler; which surely is the usual resolution of a need
>for long lookaheads.

(I used to assist a lecturer, Thijs Zoethout, who once worked for CDC. He
once explained the following in great length to me) One of the tricks used
in the CDC Algol 68 compiler was to let the lexical analyzer do some
lookahead for inadequate states. Some ambiguities in the parser grammar
can be resolved this way. One case was to recognise the start of a
'routine text', i.e. a procedure parameter list followed by the procedure
body. The ambiguity arises from the extreme overloading of brackets. A
routine text:

(INT a, b, c)INT: (a + b + c)

A 'serial clause':

(INT a, b, c; read((a,b,c)); print((a+b+c, newline)))

This case could be decided by letting the lexical analyser look for the
semicolon or other features that can't occur in a parameter list.
Ge' Weijers Internet/UUCP:
LCN tel. +3180238130 (UTC+1,
P.O.Box 1408 UTC+2 march/september
6501 BK Nijmegen, the Netherlands

Post a followup to this message

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