Crystal Lang for Arduino(ESP8266)

299 views
Skip to first unread message

test test

unread,
Oct 24, 2018, 12:19:19 PM10/24/18
to Crystal
Hello there,

it would be very nice if the crystal programming language can be used as programming language for Arduino or ESP8266. Are there future plans to port that over?

Greetings

Will Lewis

unread,
Oct 24, 2018, 2:32:22 PM10/24/18
to Crystal
I would love to be able to write Crystal for these types of platforms. I think one of the biggest reasons not much movement has happened on this front is that the memory requirements for Crystal are higher than many embedded platforms support. On top of that, it would take a lot of work hooking into the LLVM bits to output Arduino or ESP firmware. 

Because of the memory requirements, I think it would almost be necessary to change Crystal so that the GC is optional (on by default, of course) before it could be ported to embedded platforms. That would be a huge undertaking into refactoring a majority if not the entire Crystal compiler. So if that was ever going to happen, it most certainly wouldn't be soon.

As far as the LLVM bits go, there has been some work on WASM LLVM support from Crystal, but again it takes a ton of work to get all the pieces working together. I think the best people to handle such a feature would be the core devs because they know the compiler the best. However, most of their time spent on Crystal is squashing bugs and getting features feature for a 1.0 release. 

All that being said, if you really want this type of feature, it might be worth looking into making it happen yourself. If you do go that route, I'm sure a few people out there would help you. 

Johannes Müller

unread,
Oct 26, 2018, 10:36:28 AM10/26/18
to Crystal
The critical part is getting LLVM to target Arduino. I don't know the state of things there.
When that's done, there probably need to be only minor changes to the Crystal compiler in order to support that target platform.

Then you should be able to compile Crystal to Arduino.
Because of the already mentioned memory restrictions on such embedded platforms, you won't be able to use Crystal's stdlib.
That's the biggest task where the Crystal community could contribute to create a minimized standard library.
However, I don't think that should be a priority right now. We need to work on Crystal 1.0, including many features of the standard library. That's where the focus should be for the next time.
Although, it could probably be fun, working out a tiny stdlib... ;)

Cheers
Reply all
Reply to author
Forward
0 new messages