Shen for the Common Language Runtime


Keywords
Shen, clr, dotnet, interpreter, lisp, mono
License
BSD-3-Clause
Install
Install-Package ShenSharp -Version 0.9.6

Documentation

Visual Studio Version F# Version Shen Version Latest Nuget .Net Build Status Mono Build Status

ShenSharp

ShenSharp Logo

ShenSharp is a port of the Shen language to the CLR.

Shen is a portable, functional programming language by Mark Tarver. It is a descendant of the LISP family of languages which also includes features commonly found in ML family languages. Shen offers pattern matching, a unique macro system, optional lazy evaluation, configurable static type checking, logic programming and a built-in compiler-compiler.

ShenSharp is built by loading the Shen kernel as Kλ and translating the resulting environment to F# ASTs and building that into a CLR assembly. Shen code loaded by this compiled kernel is translated into optimized expressions and evaluated on demand. Some optimizations used include inlining direct references to global symbols, expression simplification and tail call optimization using trampolines.

This port passes all tests in the Shen standard test suite, making this a certifiable implementation. Current test run time is about 40 seconds in the Windows/.Net build on AppVeyor.

Refer to the CI build scripts (appveyor.yml, .travis.yml) for build instructions.

Shen Resources

CLR Platform Support Status

Guided Tour of the Code

  • Types - Defines types for Kλ Values, Functions, Environment and IO
  • Evaluator - Interprets Kλ syntax trees, rendering Kλ values and performing side effects
  • Builtins - Primitive functions required by Kλ
  • Startup - Builds a primitive Kλ environment
  • Reader - Parses Kλ code
  • Compiler - Translates an environment of Kλ expressions into a F# module AST
  • Runtime - Helpful functions for embedding Shen in another application
  • ExtensionMethods - Extension method versions of functions in Runtime to give API a C# feel
  • RunRepl - Interpretation of command line arguments passed to Shen.exe