Re: Forcing multiple parse stacks to 'reduce'

2005-03-02 Thread Derek M Jones
Hans,

>>typedef x y;
>>typedef i j;
>>{
>>
>>is a syntactically valid function definition.
>
>So it seems, but I have not been able to figure out which function. :-)

The syntax does not permit an empty declaration.  So x must
be the declarator.  The second typedef is simply a declaration
and is not necessary for this to be a syntactically correct
function definition.  It's presence simply increases to the
amazement factor.

> The
>problem is that C has some grammar difficulties.

The C declaration grammar was designed to mimic
the syntax of how the declarator would appear in an
expression.  Irrespective of whether this is a good idea
in itself, the resulting declaration syntax is not people
friendly.

My current problem is (courtesy of the last documentation
update)  a reported ambiguity in:

static foo (bar);
static int foo (lose);

Both declarations parse ok when they are the only line in a
file.  Putting both lines together gives a surprising ambiguity
report.

>I have some vague memory that somebody found (fairly late, in the 90'ies) a
>grammar transformation to make C becoming LALR(1) (modulo the usual context
>tweaks for "typedef", etc.) Then you would not need using the %glr option.
>You might check the newsgroup comp.compilers and its FAQ, published there
>monthly.

I have a lalr(1) grammar for C (who doesn't?).  The first edition
of Harbison&Steele list the output from such a tool for C.

My interest is in measuring visible source (see
www.knosof.co.uk/cbook/usefigtab.pdf ; skip to
table 26; the source of many of the tools can be found
at: www.knosof.co.uk/cbook/srccnt.tgz ) and using a
grammar that is as close as possible to that given in the
C Standard has many advantages.  Performance is not
an issue (not that I think that nondeterministic parsing would
be a  performance bottleneck).


derek

--
Derek M Jones   tel: +44 (0) 1252 520 
667
Knowledge Software Ltdmailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing   http://www.knosof.co.uk




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: Identifying rule responsible for lookahead

2005-03-02 Thread Hans Aberg
Please keep the cc to help-bison so that others may help.

On 2005/03/02 00:38, Soumitra Kumar at [EMAIL PROTECTED] wrote:

> Thanks for your comment.
> I thought there may be a way to get this information
> from --trace option, that's why I posted on help-bison
> list.

The question is how.

> I have read the LALR(1) and bison algorithm (I forgot
> the author's name). I was wondering if there is any
> design document of bison. Actually I had tried to hack
> bison code to print it, but could not. If there any
> documentation it would help.

No, there is no such Bison design doc's: Only reading the Bison source code
itself. (Apart from that somebody wrote something in Spanish, I think.)

> -Soumitra.
> 
>> 
>> The problem is how to extract the information from
>> the LALR(1) algorithm, if
>> possible. Do you have any suggestion? (I may think a
>> bit more on the
>> question.)
>> 
>> It is otherwise not a help-bison issue, but a
>> "featuritis" issue, which
>> normally should be posted in the bug-bison list.
>> 
>> Hans Aberg
> 
> 
> 
> __
> Do you Yahoo!? 
> Yahoo! Mail - Find what you need with new enhanced search.
> http://info.mail.yahoo.com/mail_250



___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: Forcing multiple parse stacks to 'reduce'

2005-03-02 Thread Hans Aberg
On 2005/03/02 17:07, Derek M Jones at [EMAIL PROTECTED] wrote:

>> I have some vague memory that somebody found (fairly late, in the 90'ies) a
>> grammar transformation to make C becoming LALR(1) (modulo the usual context
>> tweaks for "typedef", etc.) Then you would not need using the %glr option.
>> You might check the newsgroup comp.compilers and its FAQ, published there
>> monthly.
> 
> I have a lalr(1) grammar for C (who doesn't?).  The first edition
> of Harbison&Steele list the output from such a tool for C.

There is nothing such in my Harbison&Steele (4th ed.). The comment I recall
was that I think it was Paul Hilfinger who asked Bjarne Stroustrup (in
cmop.compilers) why certain C++ ambiguities where in that language, and the
latter replied it had to do with the fact that they had not a C LALR(1)
grammar at the time the designed those C++ features. But my memory could be
wrong.

  Hans Aberg




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: Identifying rule responsible for lookahead

2005-03-02 Thread Henrik Sorensen
On Wednesday 02 March 2005 19.50, Hans Aberg wrote:
> Please keep the cc to help-bison so that others may help.
could you restate your problem ?


___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: Identifying rule responsible for lookahead

2005-03-02 Thread Soumitra Kumar
For the grammar:

%token YYID YYDOT
%%
identifier : hier_id
;
hier_id : simple_id
| hier_id opt_select YYDOT simple_id
;
opt_select :
| opt_select '[' expr ']'
;

simple_id : YYID ;
expr : hier_id
| function_call
;
function_call : expr YYDOT YYID
;

Is it possible to get following output from bison?

state 10

3 hier_id: hier_id . opt_select YYDOT simple_id
4 opt_select: .  [YYDOT (3), '[' (5)]
^^^  ^^^
5   | . opt_select '[' expr ']'
7 expr: hier_id .  [YYDOT (9), ']' (5)]
  ^^^  ^^^
YYDOT reduce using rule 4 (opt_select)
YYDOT [reduce using rule 7 (expr)]

i.e. annotate the rule which is responsible for any
lookahead symbol.

-Soumitra.

--- Henrik Sorensen <[EMAIL PROTECTED]> wrote:

> On Wednesday 02 March 2005 19.50, Hans Aberg wrote:
> > Please keep the cc to help-bison so that others
> may help.
> could you restate your problem ?
> 





__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


does your cre.dit stink?'

2005-03-02 Thread Jody McCauley

How's your credit?
To finance anything, home or car, credit is all that matters.  RAISE your credit score in 30 days.
The three main credit bureaus gather your personal information and sell it for a fee.  The Fair Credit Reporting Act gives the consumer (you) the right to contest items on your report. You may think that things have to remain on your report for seven years. That is a lie.  The problem is that The Fair Credit Report Act gives YOU rights. If you choose not to excercise your rights then negative items will continue to damage your credit.
Let us show you how credit repair can work for you



___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Re: bison install

2005-03-02 Thread Alfonso Urdaneta
Plantier, Spencer wrote:
I have installed m4-1.4 and made sure the path is in my path statement.
When I install bison I get the following error:
checking for gnum4... no
checking for m4... /usr/ccs/bin/m4
checking whether m4 supports frozen files... no
configure: error: GNU M4 1.4 is required
Any help would be appreciated. 

try
m4 --version
if you don't have 1.4, then you need to download and install it.
Alfonso.
___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison