gzah

gzah

Convert a specific language to Elixir

Is there a way to convert constructs in a specific language to Elixir code ? More specifically I was thinking about how to convert the syntax in this paper to Elixir code.

Most Liked

lucaong

lucaong

Well, then, there you have your answer.

More generally, this question is hard to answer, as it is too vague. What do you mean by converting? If you mean “writing a program that does the same thing”, that’s in principle possible with any general purpose programming language, given that you have enough patience. If you mean “transliterating line by line” it might not be.

mindok

mindok

It’s a very general question, and you linked to a decent sized paper. I don’t think you can really expect a reply in 15mins…

… but anyway, here goes.

From a very brief glance it looks like an object-oriented language used in the paper. Generally that doesn’t really map too well to Elixir, a functional language and there would almost certainly be no automated conversion.

If you want an answer to a specific question (e.g. please give me some pointers on converting the following algorithm in Java to Elixir ) then you may get a quicker answer.

mindok

mindok

Sounds like you are looking for some ideas on implementing a transpiler. Here’s one that converts erlang to elixir - probably a little easier as they are conceptually more similar, but it might give you some ideas.

This might also give you some ideas - lexing & parsing a bespoke language in Elixir: https://github.com/fabrik42/writing_an_interpreter_in_elixir

gzah

gzah

Thanks a lot.

Where Next?

Popular in Questions Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New

Other popular topics Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement