summaryrefslogtreecommitdiff
path: root/examples/systemS/Precedence.gf
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-06-25 16:54:35 +0000
committeraarne <aarne@cs.chalmers.se>2008-06-25 16:54:35 +0000
commite9e80fc389365e24d4300d7d5390c7d833a96c50 (patch)
treef0b58473adaa670bd8fc52ada419d8cad470ee03 /examples/systemS/Precedence.gf
parentb96b36f43de3e2f8b58d5f539daa6f6d47f25870 (diff)
changed names of resource-1.3; added a note on homepage on release
Diffstat (limited to 'examples/systemS/Precedence.gf')
-rw-r--r--examples/systemS/Precedence.gf42
1 files changed, 0 insertions, 42 deletions
diff --git a/examples/systemS/Precedence.gf b/examples/systemS/Precedence.gf
deleted file mode 100644
index 7defd19aa..000000000
--- a/examples/systemS/Precedence.gf
+++ /dev/null
@@ -1,42 +0,0 @@
-resource Precedence = open (Predef = Predef) in {
-
- param
- PAssoc = PN | PL | PR ;
-
- oper
- Prec : PType = Predef.Ints 4 ;
- PrecExp : Type = {s : Str ; p : Prec ; a : PAssoc} ;
-
- mkPrec : Prec -> PAssoc -> Str -> PrecExp = \p,a,f ->
- {s = f ; p = p ; a = a} ;
-
- usePrec : PrecExp -> Prec -> Str = \x,p ->
- case <<x.p,p> : Prec * Prec> of {
- <3,4> | <2,3> | <2,4> => paren x.s ;
- <1,1> | <1,0> | <0,0> => x.s ;
- <1,_> | <0,_> => paren x.s ;
- _ => x.s
- } ;
-
- useTop : PrecExp -> Str = \e -> usePrec e 0 ;
-
- constant : Str -> PrecExp = mkPrec 4 PN ;
-
- infixN : Prec -> Str -> (_,_ : PrecExp) -> PrecExp = \p,f,x,y ->
- mkPrec p PN (usePrec x (nextPrec p) ++ f ++ usePrec y (nextPrec p)) ;
- infixL : Prec -> Str -> (_,_ : PrecExp) -> PrecExp = \p,f,x,y ->
- mkPrec p PL (usePrec x p ++ f ++ usePrec y (nextPrec p)) ;
- infixR : Prec -> Str -> (_,_ : PrecExp) -> PrecExp = \p,f,x,y ->
- mkPrec p PR (usePrec x (nextPrec p) ++ f ++ usePrec y p) ;
-
- prefixR : Prec -> Str -> PrecExp -> PrecExp = \p,f,x ->
- mkPrec p PR (f ++ usePrec x p) ;
-
- nextPrec : Prec -> Prec = \p -> case <p : Prec> of {
- 4 => 4 ;
- n => Predef.plus n 1
- } ;
-
- paren : Str -> Str = \s -> "(" ++ s ++ ")" ;
-
-}