help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identifying start of new rule


From: Test User
Subject: Re: Identifying start of new rule
Date: Sun, 16 Jun 2013 06:09:26 -0500

On Sun, Jun 16, 2013 at 1:29 AM,  wrote:
> If I've understood correct, two points come to mind:
>
> a) exp : exp exp | ...
>
> Seems highly ambiguous for no good reason. BTW, did you
> really want to exclude the possibility of productions that have
> only one symbol on the right-hand side?

No, I want to parse a file that contains arbitrary legal BNF productions.

>  Not sure why you
> wouldn't use very standard/common constructs for defining
> lists with n or more members.
>

Because I don't know them, unless you mean something like:

zero_or_more_items : /* empty */
| zero_or_more_items item ;

one_or_more_items : item zero_or_more_items ;

item : blah-blah-blah

> b) 2 token lookahead.
>
> You may want to google "yacc manual" and read their discussion
> of the yacc grammar being LR(2) and their solution of having the
> lexer look ahead and return a different token type for a name
> followed by a ':'.
>

I will try this if the alternative  grammar that I found (see my reply
to Chris) does not solve the problem.

Regards,
Test User.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]