1 Star 1 Fork 0

Zeneks / calc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
calc.l 502 Bytes
一键复制 编辑 原始数据 按行查看 历史
ZNX-GITHUB 提交于 2022-08-18 23:35 . 完善clear命令,完成了发行版
%{
#include <stdio.h>
#include "./y.tab.h"
int yywrap (void) {
return 1;
}
%}
%%
"+" return ADD;
"-" return SUB;
"*" return MUL;
"/" return DIV;
"\n" return CR;
"(" return BL;
")" return BR;
(Q|q)(U|u)(I|i)(T|t) {
printf ("bye\n");
exit (0);
}
([1-9][0-9]*)|0|([0-9]+\.[0-9]+) {
double temp;
sscanf (yytext, "%lf", &temp);
yylval.double_value = temp;
return DOUBLE_LITERAL;
}
[ \t] ;
. {
fprintf (stderr, "lexical error.\n");
exit (1);
}
%%
C
1
https://gitee.com/xykong_znx/calc.git
git@gitee.com:xykong_znx/calc.git
xykong_znx
calc
calc
master

搜索帮助