aboutsummaryrefslogtreecommitdiff
path: root/06/main.y
blob: 25005df7a6bedaebce4985dd23da91fdcdcd8f5a (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 yylex();
int yyerror(char *);
%}

%token A B ERR

%%

S:
 A S B
 |
 ;

%%

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

int main() {
    yyparse();
    printf("valid string\n");
    return 0;
}