|LR(n) parsers firstname.lastname@example.org (Steve Boswell) (1991-10-10)|
|Re: LR(n) parsers KARSTEN@tfl.dk (Karsten Nyblad, TFL, Denmark) (1991-10-13)|
|Re: LR(n) parsers email@example.com (1991-10-14)|
|Re: LR(n) parsers firstname.lastname@example.org (1991-10-14)|
|Re: LR(n) parsers email@example.com (1991-10-14)|
|Re: LR(n) parsers firstname.lastname@example.org (1991-10-14)|
|Re: LR(n) parsers email@example.com (1991-10-15)|
|Re: LR(n) parsers firstname.lastname@example.org (Nick Haines) (1991-10-16)|
|Re: LR(n) parsers email@example.com (1991-10-18)|
|Re: LR(n) parsers firstname.lastname@example.org (Raul Deluth Miller-Rockwell) (1991-10-19)|
|Re: LR(n) parsers email@example.com (Thomas Schoebel) (1991-10-19)|
|[6 later articles]|
|From:||firstname.lastname@example.org (Dr A. N. Walker)|
|Organization:||Maths Dept., Nott'm Univ., UK.|
|Date:||Mon, 14 Oct 1991 16:58:03 GMT|
In article 91-10-036 Steve Boswell <email@example.com> writes:
>What sort of easily-describable or commonly-occuring grammars are
>ambiguous for any amount of lookahead?
I don't know whether it could still be described as "common" or
as "easily describable", but Algol [68, of course] is full of such things.
To give three simple examples:
a) In "BEGIN A a; B b; C c; D d; ....", A, B, C, D, ... could be mode
[type] names, in which case we are declaring identifiers a, b, c, d;
or they could [any or all of them] be monadic operators operating
[and presumably having side-effects] on the global variables a, b,
c, d. You can't in general tell until you reach the end of the
program, as the declarations of A, B, C, D don't have to precede
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.
c) "(foo, bar, baz, ...", where "foo" etc could be arbitrarily messy
units, could be the start of a collateral clause, or could be the
start of an abbreviation for "[1:foo, 1:bar, ...] SOMEMODE a",
declaring an array.
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.
Andy Walker, Maths Dept., Nott'm Univ., UK.
Return to the
Search the comp.compilers archives again.