/sea

The programming language of my dreams

Primary LanguageElixir

Sea 🌊

seac tests

This is Sea, a Lisp-like language implemented in Elixir, and I will be shaping this language as I go, trying to ergonomically incorporate the ideas I find important. Among these the most prevalent are perhaps the ability to speak of the domain and reason about composition soundness, provided, typically, by the type systems, the idea of tests being integral to software development, modularity and concurrency.

I plan to play with continuations and the concurrency of Elixir, the idea of composition via pipelines along with the idea of a computation that can fail or succeed in an environment, as in ZIO, try out some non-nomitaive static typing...

The possibilities are endless.

The name for the language is intentionally chosen to be a homophone to the C language, to spread confusion amongst those discussing it.

You can browse the fixtures for some Sea examples. Below are a few programms, just to give you a taste.

Length of a list via recursive definition \ length.sea

( ; length of a list
  (define fruits (quote (apple pineapple pie)))
  (define length
    (lambda (list)
      (cond
        ((null? list) 0)
        (else (+ 1 (length (cdr list)))))))

  (length fruits))

Length of a list via the Y combinator \ length-y.sea

(((lambda (le) ; setting up with Y combinator
    ((lambda (f) (f f))
     (lambda (f)
      (le (lambda (x) ((f f) x))))))
  (lambda (length) ; calculating the length of a list
        (lambda (l)
          (cond
            ((null? l) 0)
            (else (+ 1 (length (cdr l)))))))) (quote (apple pineapple pie)))

Structure

Evaluator

TBD

Tokenizer

TBD

Runner

TBD

Build and run

Clone the repo, go to seac folder and run:

$ mix deps.get

To run the tests with a watcher, do:

$ mix test.watch

To evaluate a Sea program, you should start the Elixir with Sea modules loaded, like so:

$ iex -S mix

Then, use the runner module and pass it the Sea file, as below:

iex(1)> SeaC.Runner.run("path/to/program.sea")

Note that the path can be relative, as well as absolute