summaryrefslogtreecommitdiff
path: root/examples/gfcc/ImperC.gf
diff options
context:
space:
mode:
authoraarne <unknown>2004-09-26 15:44:08 +0000
committeraarne <unknown>2004-09-26 15:44:08 +0000
commit693cbcb2f387aa6b0c782e46cb14c0769be26c43 (patch)
tree2233151f495d9da9a44208d260d5a4fa0748e137 /examples/gfcc/ImperC.gf
parente1617bbb8e7d7dfa8ba4ba50cf1c321610f57ace (diff)
almost the final version
Diffstat (limited to 'examples/gfcc/ImperC.gf')
-rw-r--r--examples/gfcc/ImperC.gf9
1 files changed, 5 insertions, 4 deletions
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 ;