polish.m

来自「用YACC实现的一个小的编译工具」· M 代码 · 共 18 行

M
18
字号
with spec;extern "C" void printf(...);extern "C" void polish(Expr e);void polish(Expr e){   match e {      rule plus (x, y)   :  printf("plus\n");   polish(x); polish(y);      rule minus (x, y)  :  printf("minus\n");  polish(x); polish(y);      rule mult (x, y)   :  printf("mult\n");   polish(x); polish(y);      rule divide (x, y) :  printf("divide\n"); polish(x); polish(y);      rule neg (x)       :  printf("neg\n");    polish(x);      rule num (x)       :  printf("%d\n", x);   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?