Taschenrechner/calclexer

23 lines
442 B
Plaintext
Raw Normal View History

2023-12-06 13:57:35 +00:00
%%
%jayscanner calcscanner
%jayparser calcparser
%class calclexer
%eofval{
return new EOF();
%eofval}
ws = [ \t\r\n]+
%%
[0-9]+ { return new INT(yytext());}
[0-9]+\.[0-9]+ { return new FLOAT(yytext());}
"(" { return new OPEN(yytext());}
")" { return new CLOSE(yytext());}
"+" { return new ADD(yytext());}
"-" { return new SUBTRACT(yytext());}
"*" { return new MULTIPLY(yytext());}
"/" { return new DIVIDE(yytext());}
{ws} { /*ignore*/ }