Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marianoguerra/efe

Elixir Flavoured Erlang: an Erlang to Elixir Transpiler
https://github.com/marianoguerra/efe

Last synced: about 1 month ago
JSON representation

Elixir Flavoured Erlang: an Erlang to Elixir Transpiler

Awesome Lists containing this project

README

        

# Elixir Flavoured Erlang

An Erlang to Elixir Transpiler

Check [otp.ex](https://github.com/marianoguerra/otp.ex) for examples of the output
generated by this tool.

Here are some blogposts with more details:

- http://marianoguerra.org/posts/elixir-flavoured-erlang-an-erlang-to-elixir-transpiler/
- http://marianoguerra.org/posts/elixir-flavoured-erlang-who-transpiles-the-transpiler/
- http://marianoguerra.org/posts/how-to-transpile-a-complex-erlang-project-with-elixir-flavoured-erlang-erldns/

## EFLFE: Elixir Flavoured Lisp Flavoured Erlang

An LFE (Lisp Flavoured Erlang) to Elixir Transpiler

⚠️ Work in Progress ⚠️

```sh
./efe pp-lfe file.conf my-code.lfe
```

Try some examples:

```sh
make lfe-test
```

Check:

- out/samples/ping_pong.ex
- out/samples/sample-module.ex
- out/samples/simple-erl-exercises.ex

## Build

```sh
rebar3 escriptize
cp _build/default/bin/efe .
```

## Run

The general format is:

```sh
efe pp file.conf file.erl+
```

where `file.conf` is a config file with the following format:

```erl
#{
% blobs, if relative (start with .) are joined with current erlang file directory
includes => [".", "../../*/include", "../../*/src"],
% map of macro names and what they should expand to
macros => #{'VSN' => '1.0', 'COMPILER_VSN' => '2.0'},
encoding => latin1, % or utf8
output_dir => "./out",
% prefix to add to compiled modules, useful when transpiling otp to avoid
% conflicts
mod_prefix => "m_"
}.
```

Here is the config used to transpile [cowboy](https://github.com/ninenines/cowboy/)

```erl
#{
includes => [".", "../include", "../../"],
macros => #{},
encoding => utf8,
output_dir => "./out"
}.
```

### Transpiling OTP

```
git clone [email protected]:erlang/otp.git
mkdir -p out
./efe pp otp.conf otp/lib/*/src/*.erl otp/erts/preloaded/src/.erl

```

Results in out/otp/

### Transpiling Cowboy

```sh
git clone https://github.com/ninenines/cowboy.git
# need header files from cowlib
git clone https://github.com/ninenines/cowlib.git
mkdir -p out
./efe pp cowboy.conf cowboy/src/*.erl
```

Results in out/cowboy