23 lines
442 B
Plaintext
Executable File
23 lines
442 B
Plaintext
Executable File
%%
|
|
%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*/ }
|