parser/calc/lexer.l
changeset 38 48f6f3918b82
parent 37 0fbbe329c3a2
child 39 46d7ec9d63bd
equal deleted inserted replaced
37:0fbbe329c3a2 38:48f6f3918b82
     8 	#include "parser.h"
     8 	#include "parser.h"
     9 %}
     9 %}
    10 
    10 
    11 %%
    11 %%
    12 
    12 
    13 [0-9]+			{ yylval = atoi(yytext); return DIGIT;    }
    13 [0-9]+		{ yylval = atoi(yytext); return DIGIT; }
    14 [a-zA-Z]		{ yylval = yytext[0]; return LETTER;      }
    14 [a-zA-Z]	{ yylval = yytext[0]; return LETTER; }
    15 "+"			return PLUS;	     
    15 "+"		{ return PLUS; }
    16 "-"			return MINUS;       
    16 "-"		{ return MINUS; }
    17 "*"			return MUL;         
    17 "*"		{ return MUL; }
    18 "/"			return DIV;       
    18 "/"		{ return DIV; }
    19 "("|")"|"="		return yytext[0]; 
    19 "("|")"|"="	{ return yytext[0]; }
    20 [ \t]+			;
    20 [ \t]+		{}
    21 \n			return yytext[0];
    21 \n		{ return yytext[0]; }
    22 .			printf("FEHLER: %s\n", yytext);
    22 .		{ printf("FEHLER: %s\n", yytext); }
    23 %%
    23 %%