From 693cbcb2f387aa6b0c782e46cb14c0769be26c43 Mon Sep 17 00:00:00 2001 From: aarne Date: Sun, 26 Sep 2004 15:44:08 +0000 Subject: almost the final version --- examples/gfcc/ImperC.gf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/gfcc/ImperC.gf') diff --git a/examples/gfcc/ImperC.gf b/examples/gfcc/ImperC.gf index cce553999..fe79cab9a 100644 --- a/examples/gfcc/ImperC.gf +++ b/examples/gfcc/ImperC.gf @@ -3,7 +3,8 @@ concrete ImperC of Imper = open ResImper in { flags lexer=codevars ; unlexer=code ; startcat=Stm ; lincat - Exp = PrecExp ; + Exp = PrecExp ; + Typ, NumTyp = {s,s2 : Str} ; Rec = {s,s2,s3 : Str} ; lin @@ -30,7 +31,7 @@ concrete ImperC of Imper = open ResImper in { While exp loop = continue ("while" ++ paren exp.s ++ loop.s) ; IfElse exp t f = continue ("if" ++ paren exp.s ++ t.s ++ "else" ++ f.s) ; Block stm = continue ("{" ++ stm.s ++ "}") ; - Printf t e = continues ("printf" ++ paren (t.s ++ "," ++ e.s)) ; + Printf t e = continues ("printf" ++ paren (t.s2 ++ "," ++ e.s)) ; Return _ exp = statement ("return" ++ exp.s) ; Returnv = statement "return" ; End = ss [] ; @@ -47,8 +48,8 @@ concrete ImperC of Imper = open ResImper in { EApp args val f exps = constant (f.s ++ paren exps.s) ; TNum t = t ; - TInt = ss "int" ; - TFloat = ss "float" ; + TInt = {s = "int" ; s2 = "\"%d\""} ; + TFloat = {s = "float" ; s2 = "\"%f\""} ; NilTyp = ss [] ; ConsTyp = cc2 ; OneExp _ e = e ; -- cgit v1.2.3