qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 7c7a8b30ea73cc5b402dab217ad6c0a72f601072
parent dcf9840baea42559d1754fde498a8537e86c20a3
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Fri,  9 Oct 2015 21:36:39 -0400

start implementing basic function calls

Diffstat:
Mminic/minic.y | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/minic/minic.y b/minic/minic.y @@ -286,6 +286,10 @@ expr(Node *n) sr.ctyp = IDIR(INT); break; + case 'C': + die("call not implemented"); + break; + case '@': s0 = expr(n->l); if (KIND(s0.ctyp) != PTR) @@ -508,7 +512,7 @@ mkstmt(int t, void *p1, void *p2, void *p3) %type <u> type %type <s> stmt stmts -%type <n> expr pref post +%type <n> expr pref post arg0 arg1 %% @@ -584,10 +588,18 @@ pref: post post: NUM | STR | IDENT - | '(' expr ')' { $$ = $2; } - | post '[' expr ']' { $$ = mkidx($1, $3); } - | post PP { $$ = mknode('P', $1, 0); } - | post MM { $$ = mknode('M', $1, 0); } + | '(' expr ')' { $$ = $2; } + | IDENT '(' arg0 ')' { $$ = mknode('C', $1, $3); } + | post '[' expr ']' { $$ = mkidx($1, $3); } + | post PP { $$ = mknode('P', $1, 0); } + | post MM { $$ = mknode('M', $1, 0); } + ; + +arg0: arg1 + | { $$ = 0; } + ; +arg1: expr { $$ = mknode(0, $1, 0); } + | arg1 ',' expr { $$ = mknode(0, $1, $3); } ; %%