41 lines
408 B
Plaintext
41 lines
408 B
Plaintext
%{
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <math.h>
|
|
|
|
void yyerror(const char *s);
|
|
int yylex(void);
|
|
|
|
%}
|
|
|
|
%union {
|
|
char *str;
|
|
}
|
|
|
|
%token <str> TEXT
|
|
|
|
%%
|
|
|
|
input:
|
|
| poly
|
|
;
|
|
|
|
poly:
|
|
TEXT {
|
|
printf($1);
|
|
free($1);
|
|
exit(1);
|
|
}
|
|
;
|
|
|
|
%%
|
|
|
|
void yyerror(const char *s) {
|
|
fprintf(stderr, "Error: %s\n", s);
|
|
}
|
|
|
|
int main() {
|
|
yyparse();
|
|
return 0;
|
|
} |