uhc-light-1.1.9.1: 103/lib/ag/CoreRun/AbsSyn.ag
DATA AGItf
| AGItf module : Mod
DATA Mod
| Mod ref2nm : {Ref2Nm} -- inverse lookup of locally introduced binding RRef's, 20150817 TBD: to be replaced with exports (see below)
moduleNm : {HsName}
moduleNr : {Maybe Int} -- sequence nr, index later into global table of modules; 20150902 TBD: remove, the Expl run variant does not depend on it anymore, the Impl variant still does
stkDepth : {Int} -- max depth of stack for setting up globals
imports : ImportL
exports : ExportL
metas : MetaL
binds : {CRArray Bind}
mbbody : MbExp
DATA Import
| Import nm : {HsName}
TYPE ImportL = [Import]
SET AllImport = Import ImportL
DATA Export
| Export nm : {HsName}
offset : {Int}
TYPE ExportL = [Export]
SET AllExport = Export ExportL
DATA Meta
| Data tyNm : {HsName}
dataCons : DataConL
TYPE MetaL = [Meta]
SET AllMeta = Meta MetaL
-- Equivalent of data type def holding the minimal pieces of info required for codegen
DATA DataCon
| Con conNm : {HsName}
tagNr : {Int} -- runtime tag
-- arity : {Int} -- nr of fields, excluding tag
TYPE DataConL = [DataCon]
SET AllDataCon = DataCon DataConL
SET AllMetaNT = AllMeta AllDataCon
DATA SExp
-- base cases
| Var ref : {RRef}
| Int int : {Int}
| Char char : {Char}
| String str : {String}
| Integer integer : {Integer}
-- Debug only
| Dbg msg : {String}
DATA Exp
-- base cases
| SExp sexpr : SExp
-- node constructor, tuple or data constructor, determined by tag
| Tup tag : {Int}
args : {CRArray SExp}
-- let bindings, recursiveness allowed, yes/no eval made explicit in rhs of binding
| Let firstOff : {Int} -- offset of first binding
ref2nm : {Ref2Nm} -- inverse lookup of locally introduced binding RRef's
binds : {CRArray Bind}
body : Exp
-- application, abstraction
| App func : Exp
args : {CRArray SExp}
| Lam mbNm : {Maybe HsName} -- possibly bound to name
nrArgs : {Int} -- nr of arguments, 0 means it is a thunk
stkDepth : {Int} -- max depth of stack
ref2nm : {Ref2Nm} -- inverse lookup of locally introduced binding RRef's
body : Exp
-- thunking, forcing, partial applications
| Force expr : Exp
-- Tail context
| Tail expr : Exp
-- case
| Case expr : SExp
alts : {CRArray Alt}
-- FFI call
| FFI prim : {RunPrim}
args : {CRArray SExp}
TYPE MbExp = MAYBE Exp
SET AllExp = Exp MbExp
DATA Alt
| Alt ref2nm : {Ref2Nm} -- inverse lookup of locally introduced binding RRef's
-- pat : Pat
expr : Exp
DATA Pat
| Con tag : {Int}
-- | BoolExpr expr : Exp
SET AllCodeNT
= Mod SExp AllExp Alt Pat
SET AllNT
= AllCodeNT AllExport AllImport AllMetaNT