scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit e011fdb4c004eeba9f35fc42a289bde407baa8ad
parent 67dd2d72eacab11d263530d495d0019168ea9d6e
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  3 Oct 2013 21:47:41 +0200

Rename node2 to node

This is the first step to an uniform binary tree, where all the
nodes being binary. This simplification will help us in order
to run over the tree.

Diffstat:
Mdecl.c | 4++--
Mexpr.c | 26+++++++++++++-------------
Mflow.c | 10+++++-----
Msyntax.h | 2+-
Mtree.c | 2+-
5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/decl.c b/decl.c @@ -322,10 +322,10 @@ listdcl(struct ctype *base) sp = nodesym(cursym); if (tp->type == FTN && yytoken == '{') { - np = node2(ODEF, sp, function(cursym)); + np = node(ODEF, sp, function(cursym)); return addstmt(lp, np); } - np = node2(ODEF, sp, accept('=') ? initializer(tp) : NULL); + np = node(ODEF, sp, accept('=') ? initializer(tp) : NULL); lp = addstmt(lp, np); } while (accept(',')); expect(';'); diff --git a/expr.c b/expr.c @@ -63,12 +63,12 @@ postfix(void) default: return np1; } node_2_childs: - np1 = node2(op, np1, np2); + np1 = node(op, np1, np2); continue; expect_iden: next(); expect(IDEN); - np1 = node2(op, np1, nodesym(yyval.sym)); + np1 = node(op, np1, nodesym(yyval.sym)); continue; next: np1 = node1(op, np1); @@ -139,7 +139,7 @@ mul(void) default: return np; } next(); - np = node2(op, np, cast()); + np = node(op, np, cast()); } } @@ -157,7 +157,7 @@ add(void) default: return np; } next(); - np = node2(op, np, mul()); + np = node(op, np, mul()); } } @@ -175,7 +175,7 @@ shift(void) default: return np; } next(); - np = node2(op, np, add()); + np = node(op, np, add()); } } @@ -195,7 +195,7 @@ relational(void) default: return np; } next(); - np = node2(op, np, shift()); + np = node(op, np, shift()); } } @@ -213,7 +213,7 @@ eq(void) default: return np; } next(); - np = node2(op, np, relational()); + np = node(op, np, relational()); } } @@ -225,7 +225,7 @@ bit_and(void) np = eq(); while (yytoken == '&') { next(); - np = node2(OBAND, np, eq()); + np = node(OBAND, np, eq()); } return np; } @@ -238,7 +238,7 @@ bit_xor(void) np = bit_and(); while (yytoken == '^') { next(); - np = node2(OBXOR, np, bit_and()); + np = node(OBXOR, np, bit_and()); } return np; } @@ -251,7 +251,7 @@ bit_or(void) np = bit_xor(); while (yytoken == '|') { next(); - np = node2(OBOR, np, bit_xor()); + np = node(OBOR, np, bit_xor()); } return np; } @@ -264,7 +264,7 @@ and(void) np = bit_or(); while (yytoken == AND) { next(); - np = node2(OAND, np, bit_or()); + np = node(OAND, np, bit_or()); } return np; } @@ -277,7 +277,7 @@ or(void) np = and(); while (yytoken == OR) { next(); - np = node2(OOR, np, and()); + np = node(OOR, np, and()); } return np; } @@ -319,7 +319,7 @@ assign(void) default: goto return_np; } next(); - np = node2(op, np, assign()); + np = node(op, np, assign()); } return_np: return np; diff --git a/flow.c b/flow.c @@ -74,7 +74,7 @@ _while(void) cond = expr(); expect(')'); push(OWHILE); - np = node2(OWHILE, cond, stmt()); + np = node(OWHILE, cond, stmt()); pop(); return np; } @@ -93,7 +93,7 @@ _do(void) expect(';'); push(ODO); - np = node2(ODO, body, cond); + np = node(ODO, body, cond); pop(); return np; } @@ -114,7 +114,7 @@ _for(void) expect(')'); push(OFOR); - np = node2(OFOR, node3(OFEXP, exp1, exp2, exp3), stmt()); + np = node(OFOR, node3(OFEXP, exp1, exp2, exp3), stmt()); pop(); return np; } @@ -144,7 +144,7 @@ _switch(void) expect(')'); push(OSWITCH); - np = node2(OSWITCH, cond, stmt()); + np = node(OSWITCH, cond, stmt()); pop(); return np; } @@ -156,7 +156,7 @@ label(void) sym = newlabel(sym, yytext); next(), next(); /* skip IDEN and ':' */ - return node2(OLABEL, nodesym(sym), stmt()); + return node(OLABEL, nodesym(sym), stmt()); } static struct node * diff --git a/syntax.h b/syntax.h @@ -25,7 +25,7 @@ extern struct node *function(struct symbol *sym); extern struct node *node3(unsigned char op, struct node *l, struct node *i, struct node *r); -extern struct node *node2(unsigned char op, struct node *l, struct node *r); +extern struct node *node(unsigned char op, struct node *l, struct node *r); extern struct node *node1(unsigned char op, struct node *i); extern struct node *nodesym(struct symbol *sym); diff --git a/tree.c b/tree.c @@ -69,7 +69,7 @@ node3(unsigned char op, struct node *l, struct node *i, struct node *r) } struct node * -node2(unsigned char op, struct node *l, struct node *r) +node(unsigned char op, struct node *l, struct node *r) { register struct node_op2 *np = xmalloc(sizeof(*np));