author | Markus Bröker <mbroeker@largo.localnet> |
Thu, 16 Apr 2009 12:49:11 +0200 | |
changeset 38 | 48f6f3918b82 |
parent 37 | 0fbbe329c3a2 |
child 39 | 46d7ec9d63bd |
permissions | -rw-r--r-- |
37 | 1 |
/** |
2 |
* test/demos/parser/lexer.ll |
|
3 |
* Copyright (C) 2008 Markus Broeker |
|
4 |
*/ |
|
5 |
||
6 |
%{ |
|
7 |
#include <stdio.h> |
|
8 |
#include "parser.h" |
|
9 |
%} |
|
10 |
||
11 |
%% |
|
12 |
||
38
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
13 |
[0-9]+ { yylval = atoi(yytext); return DIGIT; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
14 |
[a-zA-Z] { yylval = yytext[0]; return LETTER; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
15 |
"+" { return PLUS; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
16 |
"-" { return MINUS; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
17 |
"*" { return MUL; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
18 |
"/" { return DIV; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
19 |
"("|")"|"=" { return yytext[0]; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
20 |
[ \t]+ {} |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
21 |
\n { return yytext[0]; } |
48f6f3918b82
Project Split finished
Markus Bröker <mbroeker@largo.localnet>
parents:
37
diff
changeset
|
22 |
. { printf("FEHLER: %s\n", yytext); } |
37 | 23 |
%% |