C compiler

This commit is contained in:
aarne
2004-09-17 22:02:35 +00:00
parent ee3e5b0ae5
commit 96890f5fad
5 changed files with 157 additions and 1 deletions

52
examples/gfcc/Imper.gf Normal file
View File

@@ -0,0 +1,52 @@
abstract Imper = {
cat
Stm ;
Typ ;
Exp Typ ;
Var Typ ;
fun
Decl : (A : Typ) -> (Var A -> Stm) -> Stm ;
Assign : (A : Typ) -> Var A -> Exp A -> Stm ;
Return : (A : Typ) -> Exp A -> Stm ;
While : Exp TInt -> Stm -> Stm ;
Block : Stm -> Stm ;
None : Stm ;
Next : Stm -> Stm -> Stm ;
EVar : (A : Typ) -> Var A -> Exp A ;
EInt : Int -> Exp TInt ;
EFloat : Int -> Int -> Exp TFloat ;
EAddI : Exp TInt -> Exp TInt -> Exp TInt ;
EAddF : Exp TFloat -> Exp TFloat -> Exp TFloat ;
TInt : Typ ;
TFloat : Typ ;
cat
Program ;
Typs ;
Fun Typs Typ ;
Body Typs ;
Exps Typs ;
fun
Empty : Program ;
Funct : (AS : Typs) -> (V : Typ) ->
(Body AS) -> (Fun V AS -> Program) -> Program ;
NilTyp : Typs ;
ConsTyp : Typ -> Typs -> Typs ;
BodyNil : Stm -> Body NilTyp ;
BodyCons : (A : Typ) -> (AS : Typs) ->
(Var A -> Body AS) -> Body (ConsTyp A AS) ;
EApp : (args : Typs) -> (val : Typ) -> Fun args val -> Exps args -> Exp val ;
NilExp : Exps NilTyp ;
ConsExp : (A : Typ) -> (AS : Typs) ->
Exp A -> Exps AS -> Exps (ConsExp A AS) ;
}