codea: verschachtelte subtraktionen funktionieren (ohne konstanten)
[uebersetzerbau-ss10.git] / codea / code.bfe
1 %{
2 #define BFEHAX
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <assert.h>
7 #include "tree.h"
8 #include "chelper.h"
9
10 %}
11
12 %start begin
13 %term O_RET=1 O_NOT=2 O_SUB=3 O_MUL=4 O_OR=5 O_LESS=6 O_EQ=7 O_ID=8
14
15 %%
16
17 begin: ret # 0 # printf("// end\n");
18 ret: O_RET(expr) # 1 # move(bnode->reg, "rax"); ret();
19
20 expr: O_ID # 1 # if(bnode->param_index > -1) move(param_reg(bnode->param_index), bnode->reg);
21 expr: O_SUB(expr,expr) # 1 # printf("\tsubq %%%s, %%%s\n", bnode->kids[0]->reg, bnode->kids[1]->reg);
22
23 %%
24
25
26 /* vim: filetype=c
27  */