aboutsummaryrefslogtreecommitdiff
path: root/8/main.y
blob: 04e98a733543d9112403e8fcc9e944b618ca3b8b (plain)
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
27
28
%{
#include <stdio.h>
#include <stdlib.h>
int yyerror(char *);
%}

%token A B
%start S

%%

S: C B
 |
 ;
C: A C
 | A A A A
 ;
%%

int main() {
    yyparse();
    printf("valid string");
}

int yyerror(char *s) {
    printf("error: %s", s);
    exit(0);
}