help-bison
[Top][All Lists]
Advanced

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

Re: sequence in a rule


From: Hans Aberg
Subject: Re: sequence in a rule
Date: Sun, 9 Nov 2008 12:12:39 +0100

On 6 Nov 2008, at 01:21, Angelika Kratochwil wrote:

it works when i have in one row just one signal, but if i have a sequence,
it didn't.
...
asig: asig COMMA STRING ™ ™ ™  { printf("signal: %s",$3);}
™ ™ ™  | STRING™ ™ ™  ™ ™ ™  { printf("signal: %s",$1);}
™ ™ ™  ;
...

has anyone an idea how i can merge a sequence? the problem is the "asig" rule in the rule "fullSignal". Please help me, I have no idea how I can
solve that.

Suppose one would want to create a list containing the string components; them, in C++ pseudocode using a std::list like container, one could write
  asig:
      STRING            { $$ = list($1); }
    | asig COMMA STRING { $$ = $1.append($3); }
  ;
Then en semantic type needs to be able to hold such a type.

  Hans






reply via email to

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