scc

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

commit 53e36437d86d46131b359596f1e62ff9f3166a0b
parent 1f93655144cbf4a81858966ea37b38a792a16aa5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 10 Aug 2014 23:29:39 +0200

Add shift operators to cc2

Diffstat:
Mcc2/cc2.h | 2++
Mcc2/cgen.c | 2++
Mcc2/parser.c | 2++
3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/cc2/cc2.h b/cc2/cc2.h @@ -71,6 +71,8 @@ enum nerrors { #define OINC ';' #define OMOD '%' #define ODIV '/' +#define OSHL 'l' +#define OSHR 'r' extern void error(unsigned nerror, ...); extern void genaddable(Node *list[]); diff --git a/cc2/cgen.c b/cc2/cgen.c @@ -126,6 +126,7 @@ xcgen(Node *np) switch (np->op) { case OINC: case OADD: case OASSIG: case OMOD: case ODIV: + case OSHL: case OSHR: break; default: abort(); @@ -192,6 +193,7 @@ xaddable(Node *np) break; case OINC: case OASSIG: case OADD: case OSUB: case OMOD: case ODIV: + case OSHL: case OSHR: xaddable(lp); xaddable(rp); break; diff --git a/cc2/parser.c b/cc2/parser.c @@ -250,6 +250,8 @@ static void (*optbl[])(char *) = { ['*'] = operator, ['/'] = operator, [':'] = operator, + ['l'] = operator, + ['r'] = operator, [';'] = increment, ['A'] = variable, ['T'] = variable,