diff options
| author | aarne <aarne@chalmers.se> | 2011-01-11 15:46:43 +0000 |
|---|---|---|
| committer | aarne <aarne@chalmers.se> | 2011-01-11 15:46:43 +0000 |
| commit | e7439d65b0e153434d3acc07df6e2a0972ee79ca (patch) | |
| tree | 36716eec18256eeb600b4a552d9cc80f8ad7f16f /book/examples/chapter8 | |
| parent | 276327f7f264e770478a6d8c6e683266505b0a55 (diff) | |
gf-book web page index and toc
Diffstat (limited to 'book/examples/chapter8')
| -rw-r--r-- | book/examples/chapter8/Calculator.gf | 7 | ||||
| -rw-r--r-- | book/examples/chapter8/CalculatorC.gf | 10 | ||||
| -rw-r--r-- | book/examples/chapter8/CalculatorJ.gf | 13 | ||||
| -rw-r--r-- | book/examples/chapter8/CalculatorP.gf | 14 | ||||
| -rw-r--r-- | book/examples/chapter8/CalculatorS.gf | 11 | ||||
| -rw-r--r-- | book/examples/chapter8/Geometry.gf | 7 | ||||
| -rw-r--r-- | book/examples/chapter8/GeometryEng.gf | 13 | ||||
| -rw-r--r-- | book/examples/chapter8/GeometryEngb.gf | 11 | ||||
| -rw-r--r-- | book/examples/chapter8/Geometryb.gf | 7 | ||||
| -rw-r--r-- | book/examples/chapter8/Graftal.gf | 7 | ||||
| -rw-r--r-- | book/examples/chapter8/Logic.gf | 21 | ||||
| -rw-r--r-- | book/examples/chapter8/LogicBEng.gf | 38 | ||||
| -rw-r--r-- | book/examples/chapter8/LogicEng.gf | 39 | ||||
| -rw-r--r-- | book/examples/chapter8/Logicb.gf | 11 | ||||
| -rw-r--r-- | book/examples/chapter8/Sierpinski.gf | 16 |
15 files changed, 0 insertions, 225 deletions
diff --git a/book/examples/chapter8/Calculator.gf b/book/examples/chapter8/Calculator.gf deleted file mode 100644 index 188c150e0..000000000 --- a/book/examples/chapter8/Calculator.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Calculator = { -flags startcat = Exp ; -cat Exp ; -fun - EPlus, EMinus, ETimes, EDiv : Exp -> Exp -> Exp ; - EInt : Int -> Exp ; -} diff --git a/book/examples/chapter8/CalculatorC.gf b/book/examples/chapter8/CalculatorC.gf deleted file mode 100644 index 99db80530..000000000 --- a/book/examples/chapter8/CalculatorC.gf +++ /dev/null @@ -1,10 +0,0 @@ -concrete CalculatorC of Calculator = open Formal, Prelude in { -lincat - Exp = TermPrec ; -lin - EPlus = infixl 0 "+" ; - EMinus = infixl 0 "-" ; - ETimes = infixl 1 "*" ; - EDiv = infixl 1 "/" ; - EInt i = constant i.s ; -} diff --git a/book/examples/chapter8/CalculatorJ.gf b/book/examples/chapter8/CalculatorJ.gf deleted file mode 100644 index c5f40c8d3..000000000 --- a/book/examples/chapter8/CalculatorJ.gf +++ /dev/null @@ -1,13 +0,0 @@ -concrete CalculatorJ of Calculator = open Prelude in { -lincat - Exp = SS ; -lin - EPlus = postfix "iadd" ; - EMinus = postfix "isub" ; - ETimes = postfix "imul" ; - EDiv = postfix "idiv" ; - EInt i = ss ("ldc" ++ i.s) ; -oper - postfix : Str -> SS -> SS -> SS = \op,x,y -> - ss (x.s ++ ";" ++ y.s ++ ";" ++ op) ; -} diff --git a/book/examples/chapter8/CalculatorP.gf b/book/examples/chapter8/CalculatorP.gf deleted file mode 100644 index 4e6315827..000000000 --- a/book/examples/chapter8/CalculatorP.gf +++ /dev/null @@ -1,14 +0,0 @@ -concrete CalculatorP of Calculator = open Prelude in { - -lincat - Exp = SS ; -lin - EPlus = infix "+" ; - EMinus = infix "-" ; - ETimes = infix "*" ; - EDiv = infix "/" ; - EInt i = i ; -oper - infix : Str -> SS -> SS -> SS = \f,x,y -> - ss ("(" ++ x.s ++ f ++ y.s ++ ")") ; -} diff --git a/book/examples/chapter8/CalculatorS.gf b/book/examples/chapter8/CalculatorS.gf deleted file mode 100644 index d8c1df456..000000000 --- a/book/examples/chapter8/CalculatorS.gf +++ /dev/null @@ -1,11 +0,0 @@ -concrete CalculatorS of Calculator = open Prelude in { - lin - EPlus = infix "plus" ; - EMinus = infix "minus" ; - ETimes = infix "times" ; - EDiv = infix ["divided by"] ; - EInt i = i ; - oper - infix : Str -> SS -> SS -> SS = \op,x,y -> - ss (x.s ++ op ++ y.s ++ "PAUSE") ; -} diff --git a/book/examples/chapter8/Geometry.gf b/book/examples/chapter8/Geometry.gf deleted file mode 100644 index 0b27d8714..000000000 --- a/book/examples/chapter8/Geometry.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Geometry = Logic ** { -fun - Line, Point, Circle : Dom ; - Intersect, Parallel : Ind -> Ind -> Atom ; - Vertical : Ind -> Atom ; - Centre : Ind -> Ind ; -} diff --git a/book/examples/chapter8/GeometryEng.gf b/book/examples/chapter8/GeometryEng.gf deleted file mode 100644 index e2e22776e..000000000 --- a/book/examples/chapter8/GeometryEng.gf +++ /dev/null @@ -1,13 +0,0 @@ ---# -path=.:present - -concrete GeometryEng of Geometry = LogicEng ** - open SyntaxEng, ParadigmsEng in { -lin - Line = mkCN (mkN "line") ; - Point = mkCN (mkN "point") ; - Circle = mkCN (mkN "circle") ; - Intersect = pred (mkV2 "intersect") ; - Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; - Vertical = pred (mkA "vertical") ; - Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; -} diff --git a/book/examples/chapter8/GeometryEngb.gf b/book/examples/chapter8/GeometryEngb.gf deleted file mode 100644 index 265f3f71a..000000000 --- a/book/examples/chapter8/GeometryEngb.gf +++ /dev/null @@ -1,11 +0,0 @@ -concrete GeometryEng of Geometry = LogicEng ** - open SyntaxEng, ParadigmsEng in { -lin - Line = mkN "line" ; - Point = mkN "point" ; - Circle = mkN "circle" ; - Intersect = pred (mkV2 "intersect") ; - Parallel = pred (mkA2 (mkA "parallel") (mkPrep "to")) ; - Vertical = pred (mkA "vertical") ; - Centre = app (mkN2 (mkN "centre") (mkPrep "of")) ; -} diff --git a/book/examples/chapter8/Geometryb.gf b/book/examples/chapter8/Geometryb.gf deleted file mode 100644 index dc39c9ce4..000000000 --- a/book/examples/chapter8/Geometryb.gf +++ /dev/null @@ -1,7 +0,0 @@ -abstract Geometry = Logic ** { -fun - Line, Point, Circle : Dom ; - Intersect, Parallel : Ind -> Ind -> Prop ; - Vertical : Ind -> Prop ; - Centre : Ind -> Ind ; -} diff --git a/book/examples/chapter8/Graftal.gf b/book/examples/chapter8/Graftal.gf deleted file mode 100644 index e85b9b2f7..000000000 --- a/book/examples/chapter8/Graftal.gf +++ /dev/null @@ -1,7 +0,0 @@ --- (c) Krasimir Angelov 2009 -abstract Graftal = { - cat N; S; - fun z : N ; - s : N -> N ; - c : N -> S ; - } diff --git a/book/examples/chapter8/Logic.gf b/book/examples/chapter8/Logic.gf deleted file mode 100644 index f2b292428..000000000 --- a/book/examples/chapter8/Logic.gf +++ /dev/null @@ -1,21 +0,0 @@ -abstract Logic = { -flags startcat = Stm ; -cat - Stm ; -- top-level statement - Prop ; -- proposition - Atom ; -- atomic formula - Ind ; -- individual term - Dom ; -- domain expression - Var ; -- variable - [Prop] {2} ; -- list of propositions, 2 or more - [Var] {1} ; -- list of variables, 1 or more -fun - SProp : Prop -> Stm ; - And, Or : [Prop] -> Prop ; - If : Prop -> Prop -> Prop ; - Not : Prop -> Prop ; - PAtom : Atom -> Prop ; - All, Exist : [Var] -> Dom -> Prop -> Prop ; - IVar : Var -> Ind ; - VString : String -> Var ; -} diff --git a/book/examples/chapter8/LogicBEng.gf b/book/examples/chapter8/LogicBEng.gf deleted file mode 100644 index b950c6b39..000000000 --- a/book/examples/chapter8/LogicBEng.gf +++ /dev/null @@ -1,38 +0,0 @@ -concrete LogicEng of Logic = open - SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { -lincat - Stm = Text ; - Prop = S ; - Atom = Cl ; - Ind = NP ; - Dom = CN ; - Var = NP ; - [Prop] = [S] ; - [Var] = NP ; -lin - SProp = mkText ; - And = mkS and_Conj ; -- A, B ... and C - Or = mkS or_Conj ; -- A, B ... or C - If A B = -- if A B - mkS (mkAdv if_Subj A) B ; - Not A = -- it is not the case that A - mkS negativePol (mkCl - (mkVP (mkNP the_Quant - (mkCN case_CN A)))) ; - All xs A B = -- for all A's xs, B - mkS (mkAdv for_Prep - (mkNP all_Predet (mkNP a_Quant - plNum (mkCN A xs)))) B ; - Exist xs A B = -- for some A's xs, B - mkS (mkAdv for_Prep - (mkNP somePl_Det (mkCN A xs))) B ; - PAtom = mkS ; - IVar x = x ; - VString s = symb s ; - BaseProp A B = mkListS A B ; - ConsProp A As = mkListS A As ; - BaseVar x = x ; - ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; -oper - case_CN : CN = mkCN (P.mkN "case") ; -} diff --git a/book/examples/chapter8/LogicEng.gf b/book/examples/chapter8/LogicEng.gf deleted file mode 100644 index eae85d255..000000000 --- a/book/examples/chapter8/LogicEng.gf +++ /dev/null @@ -1,39 +0,0 @@ -concrete LogicEng of Logic = open - SyntaxEng, (P = ParadigmsEng), SymbolicEng, Prelude in { -lincat - Stm = Text ; - Prop = {pos,neg : S ; isAtom : Bool} ; - Atom = Cl ; - Ind = NP ; - Dom = CN ; - Var = NP ; - [Prop] = ListS ; - [Var] = NP ; -lin - SProp p = mkText p.pos ; - And ps = complexProp (mkS and_Conj ps) ; - Or ps = complexProp (mkS or_Conj ps) ; - If A B = complexProp (mkS if_then_Conj (mkListS A.pos B.pos)) ; - Not A = complexProp A.neg ; - All xs A B = complexProp (mkS (mkAdv for_Prep - (mkNP all_Predet (mkNP a_Quant plNum (mkCN A xs)))) B.pos) ; - Exist xs A B = complexProp (mkS (mkAdv for_Prep - (mkNP somePl_Det (mkCN A xs))) B.pos) ; - PAtom p = - {pos = mkS p ; neg = mkS negativePol p ; isAtom = True} ; - IVar x = x ; - VString s = symb s ; - BaseProp A B = mkListS A.pos B.pos ; - ConsProp A As = mkListS A.pos As ; - BaseVar x = x ; - ConsVar x xs = mkNP and_Conj (mkListNP x xs) ; -oper - complexProp : S -> {pos,neg : S ; isAtom : Bool} = \s -> { - pos = s ; - neg = negS s ; - isAtom = False - } ; - negS : S -> S = \s -> mkS negativePol (mkCl (mkNP it_Pron) - (mkNP the_Quant (mkCN (mkCN (P.mkN "case")) s))) ; - if_Then_Conj : Conj = P.mkConj "if" "then" ; -} diff --git a/book/examples/chapter8/Logicb.gf b/book/examples/chapter8/Logicb.gf deleted file mode 100644 index 5b5aa9ab9..000000000 --- a/book/examples/chapter8/Logicb.gf +++ /dev/null @@ -1,11 +0,0 @@ -abstract Logic = { -cat - Prop ; Ind ; Dom ; Var ; [Prop] {2} ; [Var] {1} ; -fun - And, Or : [Prop] -> Prop ; - If : Prop -> Prop -> Prop ; - Not : Prop -> Prop ; - All, Exist : [Var] -> Dom -> Prop -> Prop ; - IVar : Var -> Ind ; - VString : String -> Var ; -} diff --git a/book/examples/chapter8/Sierpinski.gf b/book/examples/chapter8/Sierpinski.gf deleted file mode 100644 index 722088ce5..000000000 --- a/book/examples/chapter8/Sierpinski.gf +++ /dev/null @@ -1,16 +0,0 @@ -concrete Sierpinski of Graftal = { - lincat N = {a : Str; b : Str} ; - lincat S = {s : Str} ; - - lin z = {a = A; b = B} ; - lin s x = { - a = x.b ++ R ++ x.a ++ R ++ x.b ; - b = x.a ++ L ++ x.b ++ L ++ x.a - } ; - lin c x = {s = "newpath 300 550 moveto" ++ x.a ++ "stroke showpage"} ; - - oper A : Str = "0 2 rlineto" ; - oper B : Str = "0 2 rlineto" ; - oper L : Str = "+60 rotate" ; - oper R : Str = "-60 rotate" ; -} |
