From f143df400ae61ae8c6387ac7bf52a4a620fcc142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Mon, 21 Sep 2026 05:00:34 -0600 Subject: [PATCH] =?UTF-8?q?prim=20syntax=20=E2=86=92=20builtin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Gyehoek/CPS/Close.hs | 4 ++-- src/Gyehoek/CPS/Convert.hs | 7 +------ src/Gyehoek/CPS/Syntax.hs | 6 +++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Gyehoek/CPS/Close.hs b/src/Gyehoek/CPS/Close.hs index 9b297dd..7aca685 100644 --- a/src/Gyehoek/CPS/Close.hs +++ b/src/Gyehoek/CPS/Close.hs @@ -18,7 +18,7 @@ genCodeName f = gensym' @Name $ f ^. _Wrapped' . to (<> "-code") bindEnv :: List Name -> Exp -> Exp bindEnv frees m = [cps| - (prim (get-env) (κ #{frees} #{m})) + (builtin (get-env) (κ #{frees} #{m})) |] close1 :: forall es. GenSym :> es => Exp -> Eff es Exp @@ -41,7 +41,7 @@ close1 = \case let codes = bs' ^.. each . _1 . to MkLabel pure [cps| (letrec #{bs'} - (prim (make-shared-closure #{codes} #{frees}) + (builtin (make-shared-closure #{codes} #{frees}) (κ #{boundNames} #{e}))) |] diff --git a/src/Gyehoek/CPS/Convert.hs b/src/Gyehoek/CPS/Convert.hs index 1628bbc..2901a56 100644 --- a/src/Gyehoek/CPS/Convert.hs +++ b/src/Gyehoek/CPS/Convert.hs @@ -49,15 +49,10 @@ convert (Scm.ExpLit l) k = k . one . ValImm $ case l of convert (Scm.ExpBuiltin p) k = telescope (convert1 @es) p \p' -> do r_l <- gensym' "r" - -- k_l <- gensym' @Name "prim-k" m <- k [ValVar r_l] pure [cps| - (prim #{p'} (κ (#{r_l}) #{m})) + (builtin #{p'} (κ (#{r_l}) #{m})) |] - -- pure [cps| - -- (letrec ((#{k_l} (κ (#{r_l}) #{m}))) - -- (prim #{p'} #{k_l})) - -- |] convert (Scm.ExpLambda xs e) k = do f <- gensym' "lambda-body" diff --git a/src/Gyehoek/CPS/Syntax.hs b/src/Gyehoek/CPS/Syntax.hs index 64c8a64..80b102b 100644 --- a/src/Gyehoek/CPS/Syntax.hs +++ b/src/Gyehoek/CPS/Syntax.hs @@ -335,7 +335,7 @@ instance S.DatumIso Abs where instance S.DatumIso Exp where datumIso = S.match - $ S.With (. prim) + $ S.With (. builtin) $ S.With (. letrec) $ S.With (. continue) $ S.With (. if_) @@ -365,8 +365,8 @@ instance S.DatumIso Exp where >>> S.el (S.datumIso @Kexp) >>> S.rest (S.datumIso @Val) >>> S.onTail S.swap - prim = S.list $ - S.el (S.decorate S.SynBuiltin >>> S.sym "prim") + builtin = S.list $ + S.el (S.decorate S.SynBuiltin >>> S.sym "builtin") >>> S.el (builtinDatumIso id (S.datumIso @Val)) >>> S.el S.datumIso