help-bison
[Top][All Lists]
Advanced

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

Re: Parsing a strange list


From: Hans Aberg
Subject: Re: Parsing a strange list
Date: Tue, 14 Aug 2001 23:22:35 +0200

[Replies please do not forget to cc address@hidden

At 11:16 -0700 2001/08/14, Joris Esch wrote:
>I have a problem writing a parser for a list.
>
>The list contains the token name and the literal character '-'
>Whenever a '-' is seen, the two names should be
>combined.

Have you tried say:

%left name
%left '-'

%%
sentence:
    sentence name         { }
  | sentence '-' sentence { }
  | name                  { }
%%

-- As in the calculator example in the Bison manual.

  Hans Aberg





reply via email to

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