I've written a Lua-like scripting langauge for Elm

So here’s a weird thing that happened: I heard that it is possible to write a (interpreter for a small) programming language in one weekend, so I tried and yes it’s possible.

The project began with me needing a multiparadim scripting languages that can be interpreted by elm. Because nobody has done this before, I decided to work on a Lua based language. Originally, I wanted to stay as true to Lua as possible, but there are a few things (like variables being global by default) that I refused to implement.

I’ve nothing yet to show (mostly because I want to finish the documentation before i share the repos) but here a quick code snipped:

let success = "great";
mut out = null;
out =
  if { mut a = out; --out is immutible inside this scope
    a = 
      40
        . Number::plus 2 --Number is an extension to the language
        . eq 42; --the definition of eq is written in a seperate Elm package
    a --a body always ends with an expression
  }
  success
  out;
out --Returns "great".

Now the thing is, this a nice little language and all, but I can’t support an ecosystem for it. In the best case, I would not have created a new language to begin with.

I’m willing to start from scratch, if someone can point me towards an existing language that

  • is small (enough, so that i can write an interpreter in a weekend)
  • is multiparadime
  • dynamically typed (type checkers are hard work to write >.<)
  • is extendable (just like lua)
  • has a c-like syntax (i know lisp exists, i just don’t like its syntax)
6 Likes

You should come join us in #language-implementation on the slack! When you open up the repo let me know and I’ll add it to the awesome-elm-pltd list.

Looks really cool.

I actually pondered whether or not writing an elm-based interpreter for Ren would be valuable. I’m not entirely sure whether you could get it going in a weekend but I’d be happy to help if you think it’s any good.

that repos is really cool. I didn’t know that this many (if any) lisp interpreters existed. I looked for “lang” on package.elm-lang.org but didn’t find much.

Right? That’s why I started it, there’s a small collection of people exploring PL in Elm but it’s been quite disjoint and silo’d for a while, do join us in the slack if you use it :innocent:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.