[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Forcing multiple parse stacks to 'reduce'
From: |
Derek M Jones |
Subject: |
Re: Forcing multiple parse stacks to 'reduce' |
Date: |
Tue, 01 Mar 2005 15:38:11 +0000 |
Hans,
>>In the case:
>>
>>typedef x, y;
>>typedef i, j;
I should have given the example as:
typedef x y;
typedef i j;
>>
>>the second typedef token is shifted onto all three stacks and
>>subsequent tokens are processed like a declaration (which they
>>do form part of)! So I don't get a parse of a single declaration
>>(in fact yyparse eventually reports an ambiguity).
Mystery solved (while cutting down the grammar to provide a
minimum example).
The syntax for function definition (clause 6.9.1) is
function-definition:
declaration-specifiers declarator declaration-list-opt compound-statement
I have changed this to:
function-definition:
declaration-specifiers declarator declaration-list-opt OPEN_CURL
I suddenly realised that the token sequence:
typedef x y;
typedef i j;
{
is a syntactically valid function definition.
Bison is correct not to perform the reductions I was
expecting. Until a {, or EOF, is seen it does not it does not
know whether it is dealing with a function definition or a
list of declarations.
derek
--
Derek M Jones tel: +44 (0) 1252 520
667
Knowledge Software Ltd mailto:address@hidden
Applications Standards Conformance Testing http://www.knosof.co.uk