Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/marianoguerra/efe
- Owner: marianoguerra
- License: apache-2.0
- Created: 2020-10-27T17:53:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-04T09:05:58.000Z (over 3 years ago)
- Last Synced: 2024-11-01T00:32:02.794Z (about 1 month ago)
- Language: Erlang
- Size: 180 KB
- Stars: 67
- Watchers: 7
- Forks: 4
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- beamtoolbox - [erl
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