Database
lex_yacc.asc
Associated article: Lex and Yacc
Tags: Database Tools Design
_LEX AND YACC_
by Ian Gorman
Listing One
1 %{
2 #include "ytab.h"
3 extern int yylval;
4 %}
5
6 %%
7
8 [A-Z] {
9 yylval = *yytext - 'A';
10 return VARIABLE;
11 }
12
13 [a-z] {
14 yylval = *yytext - 'a';
15 return VARIABLE;
16 }
17
18 [0-9]+ {
19 yylval = strtol(yytext, (char **)NULL, 0);
20 return INTEGER;
21 }
22
23 0x[0-9...


