summaryrefslogtreecommitdiff
path: root/examples/gfcc/ResImper.gf
diff options
context:
space:
mode:
authoraarne <unknown>2004-09-18 09:24:51 +0000
committeraarne <unknown>2004-09-18 09:24:51 +0000
commit3a1f403a0146f4717b210373167640a07f0248dd (patch)
treeaf1fe17319c7dd20117b9b842c01b52b35fe96fd /examples/gfcc/ResImper.gf
parent6ec3a53d3cd1666696430d25e1d0c746f3c7dde8 (diff)
doc
Diffstat (limited to 'examples/gfcc/ResImper.gf')
-rw-r--r--examples/gfcc/ResImper.gf29
1 files changed, 25 insertions, 4 deletions
diff --git a/examples/gfcc/ResImper.gf b/examples/gfcc/ResImper.gf
index d77322d75..8cdd4f8b7 100644
--- a/examples/gfcc/ResImper.gf
+++ b/examples/gfcc/ResImper.gf
@@ -1,13 +1,34 @@
resource ResImper = open Prelude, Precedence in {
oper
+ PrecExp : Type = {s : PrecTerm} ;
continue : Str -> SS -> SS = \s -> infixSS ";" (ss s);
statement : Str -> SS = \s -> postfixSS ";" (ss s);
- ex : {s : PrecTerm} -> Str = \exp -> exp.s ! p0 ;
- infixL :
- Prec -> Str -> {s : PrecTerm} -> {s : PrecTerm} -> {s : PrecTerm} =
+ ex : PrecExp -> Str = \exp -> exp.s ! p0 ;
+ infixL : Prec -> Str -> PrecExp -> PrecExp -> PrecExp =
\p,h,x,y -> {s = mkInfixL h p x.s y.s} ;
+ infixN : Prec -> Str -> PrecExp -> PrecExp -> PrecExp =
+ \p,h,x,y -> {s = mkInfix h p x.s y.s} ;
- constant : Str -> {s : PrecTerm} = \c -> {s = mkConst c} ;
+ constant : Str -> PrecExp = \c -> {s = mkConst c} ;
+
+ param
+ Size = Zero | One | More ;
+ oper
+ nextSize : Size -> Size = \n -> case n of {
+ Zero => One ;
+ _ => More
+ } ;
+ separator : Str -> Size -> Str = \t,n -> case n of {
+ Zero => [] ;
+ _ => t
+ } ;
+
+-- for JVM
+ Instr : Type = {s, s3 : Str} ; -- code, labels
+ instr : Str -> Instr = \s -> statement s ** {s3 = []} ; ----
+ instrc : Str -> Instr -> Instr = \s,i -> statement (s ++ i.s) ** {s3 = i.s3} ; ----
+ binop : Str -> SS -> SS -> SS = \op, x, y ->
+ ss (x.s ++ y.s ++ op ++ ";") ;
} \ No newline at end of file