bryanjos

bryanjos

In my Lonestar Elixir presentation on Elixirscript I mentioned compiling from Beam files. About a 2 weeks ago, I started to play around with getting the Erlang Abstract Format from beam files. From there, I started thinking about turning that format into JavaScript. That project is rayscript

There are a couple of big advantages to doing so over Elixirscript’s implementation. The biggest one is that it could enable all languages on the Beam to convert code to JavaScript. Another is that compile time features, such as macros in Elixir, would not be a concern. Yet another would be that OTP should be easier to support as long as the beam files are available. I did some tests and was able to retrieve the format from beam files in both the Erlang and Elixir standard libs and convert to JavaScript. A question I get asked about a lot with Elixirscript are around processes. The problem isn’t that there is not an implementation for processes. One exists. The problem was one of integrating it within what already exists in Elixirscript. Starting from the beginning means that it will be a simpler task of adding it in.

The work done in Elixirscript helps a lot here. Most of what is there now is modified from Elixirscript. There are a few new problems. The biggest one being around how to handle NIFs. Also, an old one around JavaScript interoperability.

Long story short, if we can implement all of the forms there, we might be in business. I’m currently looking for any help on the project. Especially from anyone who can help with implementation, may have experience with other Beam languages, or who would be interested in helping with whatever underlying JavaScript that would be needed.

Most Liked Switch mode

OvermindDL1

OvermindDL1

Looks fascinating!

Well NIF’s and Ports sound like great integration points between Rayscript and javascript at least. ^.^

If you are curious in Elixir AST → Javascript compilation, there is an old project that did most of it at GitHub - synrc/shen: 🐉 SHEN: Erlang JavaScript Compiler · GitHub if you are curious about any code to swipe or so since that project is long-dead. :slight_smile:

Shen worked based on a parse_transform though, much different method.

bryanjos

bryanjos OP

Thanks! I’ve seen shen before, but I think I will look to see how they implemented tail recursion.

I started looking into the idea after looking more and more into bucklescript recently since I see that both Ocaml and Reason can both use it. I’ve been interested in OCaml for a while now for some things and started taking the dive into it.

Where Next? Top

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
387 15136 120
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
woylie
Phoenix components for pagination, sortable tables and filter forms with Flop and (optionally) Ecto. pagination cursor pagination sorta...
New
kip
Please say hi to a new lib, Astro that aims to deliver easy-to-consume astronomy calculations of practical use. For now it only calculat...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

Other Trending Topics Top

juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New

We're in Beta

About us Mission Statement