Home

Awesome

Salt Intermediate Language Build Status

Salt is what you get when you leave C out in the sun for too long.

Salt is the compilation target that functional programmers always wanted.

Salt is a System-F variant intended as an intermediate language between higher level languages and an abstract assembly language (LLVM). Hand written code can also be used to implement runtime systems. The Disco Discus Compiler uses an earlier version of Salt (v1), and its runtime system is written in it. This current repo contains a newer version of Salt (v2) which is being split out into its own project. Salt v1 has a working LLVM backend, but the one for v2 in this repo is still a work in progress.

Example

We have some small "Hello World" type examples and test cases, but no larger programs yet. See the demo and syntax directories in this repo. The syntax looks like:

term reverse @[a: #Data] [xx: #List a]: #List a
 = case #list'case @a xx of
        { nil  [] → [list a|]
        ; cons [x: a, xs: #List a]
           → append @a [reverse @a xs, #list'one @a x] }

test eval reverse
 = reverse @#Nat [list #Nat| 10, 12, 13, 14]

The @[a: #Data] indicates a type parameter, and @a in the body is a type argument. Names starting with # are primitive constructors and operators. Test cases can be defined inline with the code and evaluated within the IDE (via the Language Server). The Salt syntax supports standard unicode symbols for punctuation, but there are also plain ASCII alternatives.

Features

The new version of the language includes:

Status

Support

The salt executable includes a server that speaks Language Server Protocol. You should be able to get this working with your favourite editor or IDE. Matching Visual Studio Code extension and color themes are available here:

Documentation

The doc directory in this repo contains further documentation.

More Information

Salt is part of the Discus project, so ask questions on the discus mailing list.