Hiss
My WIP hobby programming language implemented in Haskell.
Hiss is my WIP hobby programming language implemented in Haskell. It is named in honor of a copperhead snake discovered in the basement of my parents’ house, which was then serving as my bedroom.
I’m building Hiss to learn more about Haskell, functional programming in general, and in particular, the implementation of functional languages. (So here’s your disclaimer: it’s neither well-tested nor stable and will almost certainly never be recommended for production use.)
Here is a sample Hiss program that computes the Collatz stopping time of 27:
// computes k mod n
mod(n, k) = if k < n
then k
else mod(n, k-n)
mod2 = mod(2) // partial application of mod
// returns stopping time of n
collatz(n, steps) = if n == 1
then steps
else if mod2(n) == 0
then collatz(n/2, steps + 1)
else collatz(3*n + 1, steps + 1)
main() = collatz(27, 0) // should output 111
Hiss is:
- Purely functional
- Strictly evaluated
- Strongly typed using the Hindley-Milner type system
- Essentially a proper superset of the lambda calculus
It supports some cool features from functional programming:
The Hiss compiler hissc
is written in Haskell and open-sourced on GitHub.
hissc
is still in progress, but it already includes:
- Hiss lexer and parser
- Semantic passes, including:
- A name-checking pass that rejects use of undeclared identifiers
- A dependency-checking pass that rejects value cycles (e.g., code like
a = b, b = c, c = a
) - A type-checking pass
- A naive, untested tree-walking interpreter and an associated REPL
Planned features include:
- Machine code generation via a LLVM backend
- An online Hiss playground