| author | Markus Bröker<broeker.markus@googlemail.com> |
| Sat, 21 Oct 2017 13:45:05 +0200 | |
| changeset 171 | c6e0af68825a |
| parent 39 | 46d7ec9d63bd |
| permissions | -rw-r--r-- |
| 37 | 1 |
/** |
2 |
* test/demos/parser/lexer.ll |
|
3 |
* Copyright (C) 2008 Markus Broeker |
|
4 |
*/ |
|
5 |
||
6 |
%{
|
|
| 39 | 7 |
#include <stdio.h> |
8 |
#include "parser.h" |
|
| 37 | 9 |
%} |
10 |
||
11 |
%% |
|
12 |
||
| 39 | 13 |
[0-9]+ { yylval = atoi(yytext); return DIGIT; }
|
14 |
[a-zA-Z] { yylval = yytext[0]; return LETTER; }
|
|
15 |
"+" { return PLUS; }
|
|
16 |
"-" { return MINUS; }
|
|
17 |
"*" { return MUL; }
|
|
18 |
"/" { return DIV; }
|
|
19 |
"("|")"|"=" { return yytext[0]; }
|
|
20 |
[ \t]+ {}
|
|
21 |
\n { return yytext[0]; }
|
|
22 |
. { printf("FEHLER: %s\n", yytext); }
|
|
| 37 | 23 |
%% |