parser/calc/lexer.l
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sun, 26 Jul 2009 18:21:25 +0200
changeset 103 be3fe4a4f097
parent 39 46d7ec9d63bd
permissions -rw-r--r--
Function Pointer Demo simplified It makes more sense to show the basic usage of fps committer: Markus Bröker <mbroeker@largo.homelinux.org>

/**
 * test/demos/parser/lexer.ll
 * Copyright (C) 2008 Markus Broeker
 */

%{
    #include <stdio.h>
    #include "parser.h"
%}

%%

[0-9]+         { yylval = atoi(yytext); return DIGIT; }
[a-zA-Z]       { yylval = yytext[0]; return LETTER; }
"+"            { return PLUS; }
"-"            { return MINUS; }
"*"            { return MUL; }
"/"            { return DIV; }
"("|")"|"="    { return yytext[0]; }
[ \t]+         {}
\n             { return yytext[0]; }
.              { printf("FEHLER: %s\n", yytext); }
%%