PhaserKell

PhaserKell

Create a compiler and a VM in Elixir

Hi, I would like to make in the near future a programming language like https://vlang.io/
I think Elixir is an excellent candidate for this job but I fear two points:

  • Would the performance be sufficient? According to some articles Elixir would be slower than Java, do you have bindings to LLVM?

  • I can’t ask my users to download the project and elixir to run it, do you have a way to get a static binary?

I am interested in GitHub - nicolasdilley/dwarf-interpreter: The compiler for the dwarf's language · GitHub and when I compile it I get a tiny binary of 1 mo, how did it do?

First Post!

kokolegorille

kokolegorille

Hello, welcome to the forum,

I cannot answer all your questions, but I can tell You dwarf-interpreter is using escript.

There is the possibiliy to build a release, a self contained file that could be run on client. Now included in Elixir 1.9 (previously, it was distillery package in charge of this).

It should be preferred when distributing your application

If You search for Erlang LLVM, You might find this pdf.

Erlang and Elixir are known for easy interoperability with other languages.

Most Liked

rvirding

rvirding

Creator of Erlang

Hi, I have done 2 languages on top Erlang/BEAM, public languages anyway, LFE (Lisp Flavoured Erlang) GitHub - lfe/lfe: Lisp Flavoured Erlang (LFE) · GitHub and Luerl GitHub - rvirding/luerl: Lua in Erlang · GitHub . The first is a Lisp which keeps the basic Erlang semantics as provide by the BEAM while the second is an implementation Lua implemented in Erlang. [*] Note that the BEAM is designed to run Erlang and most the of the Erlang language features are directly implemented in the BEAM.

Luerl works by compiling down to a VM for which I have then written an interpreter. This to provide the data and code handling which Lua requires but is not provided by the BEAM. Basically Lua has shared, mutable and global data which we don’t do. Yes, the resulting language is slower but the Erlang interface is fast and you get free access to Erlang’s concurrency and parallelism.

[*] I call the first “native” languages on the Erlang Ecosystem, Elixir is of course another one, while the second “non-native” languages.

NobbZ

NobbZ

What kinds of documents do you mean?

There is the BEAM book and also BEAM wisdom. Perhaps you can find even more valuable resources in Best resources on BEAM internals?.

As well as there might be some wisdom available in the OTP sourcecode or in the two RUST re-implementations ErlangRT and enigma.

You could, but if your language has a lot of mutability or objects (I do infer this from your constant mention of the JVM) or other semantics building on those, then the BEAM is probably not a suitable runtime for your language.

Still, building a compiler for your language on the BEAM is a valid choice.

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement