mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-15 22:22:51 -06:00
top-level toy compiler - far from complete
This commit is contained in:
16
devel/compiler/TMacros.hs
Normal file
16
devel/compiler/TMacros.hs
Normal file
@@ -0,0 +1,16 @@
|
||||
module TMacros where
|
||||
|
||||
import AbsTgt
|
||||
|
||||
appVal :: Val -> [Val] -> Val
|
||||
appVal v vs = compVal vs v
|
||||
|
||||
compVal :: [Val] -> Val -> Val
|
||||
compVal args = comp where
|
||||
comp val = case val of
|
||||
VRec vs -> VRec $ map comp vs
|
||||
VPro r p -> case (comp r, comp p) of
|
||||
(VRec vs, VPar i) -> vs !! fromInteger i
|
||||
VArg i -> args !! fromInteger i
|
||||
VCat x y -> VCat (comp x) (comp y)
|
||||
_ -> val
|
||||
Reference in New Issue
Block a user