1
0
forked from GitHub/gf-core

Transfer: Changed transfer program file extension from .tr to .tra to avoid collision with Troff file extension.

This commit is contained in:
bringert
2005-12-06 16:33:40 +00:00
parent 099e5068d7
commit 900a8f1142
18 changed files with 12 additions and 12 deletions

33
transfer/examples/exp.tra Normal file
View File

@@ -0,0 +1,33 @@
import prelude
data Cat : Type where
Stm : Cat
Exp : Cat
Var : Cat
Typ : Cat
ListStm : Cat
data Tree : Cat -> Type where
SDecl : Tree Typ -> Tree Var -> Tree Stm
SAss : Tree Var -> Tree Exp -> Tree Stm
SBlock : Tree ListStm -> Tree Stm
EAdd : Tree Exp -> Tree Exp -> Tree Exp
EStm : Tree Stm -> Tree Exp
EVar : Tree Var -> Tree Exp
EInt : Integer -> Tree Exp
V : String -> Tree Var
TInt : Tree Typ
TFloat : Tree Typ
NilStm : Tree ListStm
ConsStm : Tree Stm -> Tree ListStm -> Tree ListStm
derive Compos Tree
rename : (String -> String) -> (C : Type) -> Tree C -> Tree C
rename f C t = case t of
V x -> V (f x)
_ -> composOp ? ? compos_Tree C (rename f) t
main = rename (const ? ? "apa") Stm (SAss (V "y") (EAdd (EVar (V "x")) (EInt 2)))