wip compile, drop let

This commit is contained in:
2024-07-14 16:48:11 -07:00
parent 127a1e7f00
commit a385d1225d
4 changed files with 26 additions and 6 deletions

26
src/Lib/Compile.idr Normal file
View File

@@ -0,0 +1,26 @@
module Lib.Compile
import Lib.Types
import Lib.Prettier
-- turn Tm into javscript
-- JS AST (or just write a Doc?)
data JSExp : Type where
data JSStmt : Type where
compile : Nat -> Tm -> Doc
-- Oh, we don't have local names...
compile l (Bnd k) = text "_\{show k}"
-- this is tied to Bnd
-- And we probably want `{...}` with statements...
compile l (Lam str t) = text "(_\{show l}) => " <+> compile (S l) t
compile l (Ref str mt) = text str
compile l (App t u) = compile l t <+> "(" <+> compile l u <+> ")"
compile l U = "undefined"
compile l (Pi str icit t u) = "undefined"
compile l (Meta k) = ?fixme_zonk