%token NUM = /(\d+)/
%token ID  = { /\G(\w+)/gc and return ('ID', $1); }

%%
A:   
      B
    | A B
;

B: 
      ID
    | a
    | NUM
;
%%