Skip to content

A modular Scheme interpreter written in Haskell using monad transformers

Notifications You must be signed in to change notification settings

ongkuanyang/scheme-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

This is a Scheme interpreter inspired by the paper "Monad Transformers and Modular Interpreters" and the book "Structure and Interpretation of Computer Programs".

The use of monad transformers allows for the abstracting away of error and environment handling from the eval function. :)


Test command:
> test (App (Lambda ["x"] (App (Prim add) [Var "x", Var "x"])) [Num 2])
> "4"

> test (Begin [(Define "factorial" (Lambda ["x"] (If (App (Prim eq) [Var "x", Num 1]) (Num 1) (App (Prim multiply) [Var "x", (App (Var "factorial") [App (Prim difference) [Var "x", Num 1]])])))), (App (Var "factorial") [Num 5])])
> "120"

About

A modular Scheme interpreter written in Haskell using monad transformers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published