uppercase.opp.exp 272 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
%start entry
%token EOF
%token B
%token A

%type <unit> entry
%%

entry:
| _1 = nonempty_list_AB_ _2 = EOF
    {          ()}

AB:
| _1 = A _2 = B
    {      ()}

nonempty_list_AB_:
| x = AB
    {    ( [ x ] )}
| x = AB xs = nonempty_list_AB_
    {    ( x :: xs )}

%%