Skip to content
A very simple Mix task that compiles LFE (lisp (flavoured (erlang)))
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib/mix
test
.formatter.exs
.gitignore
README.md
mix.exs
mix.lock

README.md

Mix LFE Compiler

A very simple Mix task that compiles LFE (lisp (flavoured (erlang))).

It is a Mix compiler which uses the Erlang Mix compiler.

Lisp is a great language to get into the functional way of thinking and LFE is Lisp 2+ which runs on the greatest platform (personal opinion). Elixir's Mix is a great (or the greatest) configuration/package/build manager, so why not use it to compile LFE? Also Elixir developers should try LFE! This little project has the purpose to make that easier.

Installation and setup

Install the Mix plugin for LFE if it isn't installed already:

mix archive.install https://github.com/meddle0x53/mix_lfe_new/releases/download/v0.2.0/mix_lfe_new-0.2.0.ez

You can create a LFE project with:

mix lfe.new <project_name>

The project uses the rebar3 lfe package to compile LFE source files, so the following will be necessary:

  1. Navigate to the root of the new project with cd <project_name>.
  2. Run mix lfe.setup.

This will install the LFE compiler and set it up, so it can be used to compile *.lfe files located in the src folder.

The project can be created and set up in one command like this:

mix lfe.new <project_name> --setup

Compilation

Compiling *.lfe sources, located in the src folder can be done with:

mix compile

To use the compiled modules with the LFE REPL, you can run:

./deps/lfe/bin/lfe -pa _build/dev/lib/*/ebin

The compiled LFE modules can be used from Elixir too:

iex -S mix

Now the modules will be accessible just like Erlang modules are accessible in Elixir.

Running tests

The compiler can compile and run ltest tests. Just put all the tests in the test folder of the project and run:

mix lfe.test

Works with umbrella applications, meaning that some of applications in the umbrella can be LFE ones.

Example projects

A list of projects created with mix_lfe. More to come.

  • Echo is an example LFE OTP application, created with mix_lfe.

TODO

The tests of this project mirror the ones for the Erlang Mix compiler. For now the source is very simple and uses an idea from the Erlang Mix compiler. All works well, but requires some manual work and doesn't support LFE compiler fine tuning, so that's what we'll be after next.

  1. Pass more options to the LFE compiler, using mix configuration.
  2. More and more examples.
  3. A mix task or binary running the LFE REPL in the context of the compiled artifacts.
  4. Add CI to this project.
  5. Make it possible to add options when running mix lfe.test. Work on making stable versions by using another test runner/library or contacting the ltest maintainers.

License

Same as Elixir.

You can’t perform that action at this time.