Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions IMPLS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ IMPL:
- {IMPL: dart}
- {IMPL: elisp}
- {IMPL: elixir}
- {IMPL: elixir.2}
- {IMPL: elm}
- {IMPL: erlang, NO_SELF_HOST: 1} # step4 silent exit on "(DO 3)"
- {IMPL: es6}
Expand Down
3 changes: 2 additions & 1 deletion Makefile.impls
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ wasm_MODE = wasmtime
#

IMPLS = ada ada.2 awk bash basic bbc-basic c c.2 chuck clojure coffee common-lisp cpp crystal cs d dart \
elisp elixir elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
elisp elixir elixir.2 elm erlang es6 factor fantom fennel forth fsharp go groovy gnu-smalltalk \
guile hare haskell haxe hy io janet java java-truffle js jq julia kotlin latex3 livescript logo lua make mal \
matlab miniMAL nasm nim objc objpascal ocaml perl perl6 php picolisp pike plpgsql \
plsql powershell prolog ps purs python2 python3 r racket rexx rpython ruby ruby.2 rust scala scheme skew sml \
Expand Down Expand Up @@ -125,6 +125,7 @@ d_STEP_TO_PROG = impls/d/$($(1))
dart_STEP_TO_PROG = impls/dart/$($(1)).dart
elisp_STEP_TO_PROG = impls/elisp/$($(1)).el
elixir_STEP_TO_PROG = impls/elixir/lib/mix/tasks/$($(1)).ex
elixir.2_STEP_TO_PROG = impls/elixir.2/lib/steps/$($(1)).ex
elm_STEP_TO_PROG = impls/elm/$($(1)).js
erlang_STEP_TO_PROG = impls/erlang/$($(1))
es6_STEP_TO_PROG = impls/es6/$($(1)).mjs
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ process guide](process/guide.md) there is also a [mal/make-a-lisp
FAQ](docs/FAQ.md) where I attempt to answer some common questions.


**3. Mal is implemented in 89 languages (95 different implementations and 118 runtime modes)**
**3. Mal is implemented in 89 languages (96 different implementations and 119 runtime modes)**

| Language | Creator |
| -------- | ------- |
Expand All @@ -64,6 +64,7 @@ FAQ](docs/FAQ.md) where I attempt to answer some common questions.
| [D](#d) | [Dov Murik](https://github.com/dubek) |
| [Dart](#dart) | [Harry Terkelsen](https://github.com/hterkelsen) |
| [Elixir](#elixir) | [Martin Ek](https://github.com/ekmartin) |
| [Elixir #2](#elixir2) | [Alessandro Cerruti](https://github.com/chrooti) |
| [Elm](#elm) | [Jos van Bakel](https://github.com/c0deaddict) |
| [Emacs Lisp](#emacs-lisp) | [Vasilij Schneidermann](https://github.com/wasamasa) |
| [Erlang](#erlang) | [Nathan Fiedler](https://github.com/nlfiedler) |
Expand Down Expand Up @@ -445,6 +446,17 @@ mix stepX_YYY
iex -S mix stepX_YYY
```

### Elixir.2

The second Elixir implementation of mal has been tested with Elixir 1.19.5 and Erlang/OTP 28.

```
cd impls/elixir.2
STEP=stepX_YYY mix run
# Or with readline/line editing functionality:
STEP=stepX_YYY iex -S mix
```

### Elm

The Elm implementation of mal has been tested with Elm 0.18.0
Expand Down
13 changes: 13 additions & 0 deletions impls/elixir.2/.credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
%{
configs: [
%{
name: "default",
checks: %{
disabled: [
{Credo.Check.Readability.ModuleDoc, []},
{Credo.Check.Refactor.CyclomaticComplexity, []}
]
}
}
]
}
4 changes: 4 additions & 0 deletions impls/elixir.2/.formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
25 changes: 25 additions & 0 deletions impls/elixir.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Temporary files, for example, from tests.
/tmp/

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
mal-*.tar

/.elixir_ls
1 change: 1 addition & 0 deletions impls/elixir.2/.iex.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mal.start_repl()
28 changes: 28 additions & 0 deletions impls/elixir.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:24.04
MAINTAINER Alessandro Cerruti <whisper@chrooti.org>
LABEL org.opencontainers.image.source=https://github.com/kanaka/mal
LABEL org.opencontainers.image.description="mal test container: Elixir.2"
##########################################################
# General requirements for testing or common across many
# implementations
##########################################################

RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python3
RUN ln -sf /usr/bin/python3 /usr/bin/python

# Some typical implementation and test requirements
RUN apt-get -y install curl libreadline-dev libedit-dev

RUN mkdir -p /mal
WORKDIR /mal

##########################################################
# Specific implementation requirements
##########################################################

# Elixir (14)
RUN apt-get install -y erlang-dev elixir
ENV HOME /mal
14 changes: 14 additions & 0 deletions impls/elixir.2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: all
all: | deps
mix compile

deps:
mix local.hex --force
mix deps.get

lib/steps/*.ex: all

.PHONY: clean
clean:
mix clean
rm -fr deps _build .elixir_ls
21 changes: 21 additions & 0 deletions impls/elixir.2/lib/mal.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
defmodule Mal do
use Application

def start(_type, _args) do
if not IEx.started?() do
start_repl()
end

{:ok, self()}
end

def start_repl() do
step =
System.fetch_env!("STEP")
|> String.split("_")
|> Enum.map_join(&String.capitalize/1)

module_name = Module.safe_concat([Mal, step])
module_name.start()
end
end
Loading