Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 1.1 KB

README.md

File metadata and controls

50 lines (37 loc) · 1.1 KB

idris-codegen-sexp

An Idris backend that outputs pretty printed Idris simplified expressions, useful for backend writers.

main : IO
main = putStrLn "Hello World!"

Becomes:

(SFun "runMain0"
      []
      1
      (SLet (Loc 0)
            (SLet (Loc 0)
                  SNothing
                  (SApp False "Main.main" [(Loc 0)]))
            (SApp True "EVAL0" [(Loc 0)])))


(SFun "Main.main"
      ["in0"]
      1
      (SLet (Loc 1)
            (SLet (Loc 1)
                  (SConst (Str ['H','e','l','l','o',',',' ','w',
                                'o','r','l','d','!','
                                ']))
                  (SOp LWriteStr [(Loc 0),(Loc 1)]))
            (SCon Nothing 0 "MkUnit" [])))


(SFun "EVAL0"
      ["arg0"]
      1
      (SChkCase (Loc 0)
                [(SDefaultCase (SV (Loc 0)))]))

Installation

stack install

Usage

idris --codegen sexp test/cases/HelloWorld.idr -o HelloWorld.sexp