Erlang to Propeller
nisbus
Posts: 46
Hi,
has anyone tried creating a compiler for Erlang to the propeller?
It seems Erlang would be a great fit for programming 8 cogs since Erlang is all about concurrency.
thanks,
nisbus
has anyone tried creating a compiler for Erlang to the propeller?
It seems Erlang would be a great fit for programming 8 cogs since Erlang is all about concurrency.
thanks,
nisbus
Comments
I was wondering if anyone had attempted to build an interpreter for Erlang to Propeller.
It's a favorite language of mine and I think it would be a natural fit for the Propeller.
thanks,
nisbus
from
http://learnyousomeerlang.com/introduction
If you have Erlang running on your windows/linux box, we could probably make something that interfaces the prop portion of the application to that.
What sort of application did you have in mind? This sounds cool.
I really don't have a specific application in mind.
The similarities with the programming style of spin and erlang just struck me as something that would open up a whole world of possibilities in programming the propeller.
In Spin you do coginit to 'spawn' some code on a new cog.
In Erlang you spawn a new process (green-thread) with some code.
Erlang is all about message passing with no mutable state which sounds perfect for programming 8 independent cogs.
Erlang is a relatively small language (it will probably fit a single A4 page) so creating a compiler for Erlang to propeller should not be that hard (for someone that knows how to build a compiler, that is).
The huge thing in Erlang is OTP (Open telecom platform) which is all about managing the spawned threads and has some patterns for programming Erlang systems but I don't see where that would be run on a propeller since that would require one cog to run the Erlang VM and somehow manage the rest of the cogs. Maybe there should be an OPP (Open propeller platform) for managing multiple propellers from a single VM running on a Win/*nix box.
I just really like the Erlang syntax and would love to be able to program the propeller using it ( i.e. binary pattern matching, list comprehension etc), I have no idea if this is possible or even feasible. I was just thinking out loud
ASM for me is just too hard, and Spin is such a weird language with a mix of C, Pascal and some other languages sprinkled on top. It would be nice to have a language that a lot of people know and a functional one to boot.
My two cents,
nisbus
In my case, I'm using FORTH to do low level implementation to do distributed coordinated parallel processing, this is an extension to the prop's multi-core simultaneous parallel processing. It is the logical layer on the hardware layer.
Erlang appears to be similar, or possibly and extension on to of a logical parallel layer. This might have a common basis to some of my work.
If you can show us the "single A4 page" example, we could probably come up with something. Interested?
If you can provide you ideal of an idealize example, and your favorite references (wiki was little terse) we can get started. This sounds really cool!
http://www.it.uu.se/research/group/hipe/cerl/doc/core_erlang-1.0.3.pdf
I'm not sure whether it would be possible to run the Erlang VM on a cog.
For starters I would love to see list comprehension and binary pattern matching on the propeller and I will probably start writing something for this soon.
As for favorite references, http://www.erlang.org documentation is the place to look for anything Erlang.
The HiPE page is also interesting http://www.it.uu.se/research/group/hipe/.
I'll keep you posted with my progress but this will probably take some time since this is my first compiler.
http://www.erlang.org/faq/implementations.html#id56464
"Getting Erlang to run on, say, an 8 bit CPU with 32kByte of RAM is not feasible". (At least they don't say impossible )
It seems that this is possible although I don't know if the memory requirements are too great for the propeller to handle.
It seems that there is a template that needs to be filled out for cross compiling it and I've attached a sample from the source as well as the readme.
What about implementing key Erlang functions in FORTH, and run interactively from the command line? The you just chose the key Erlang functions, and tailor them to prop architecture. Lots of extra cogs, and lots of extra space.
What are the key Erlang functions? Tuple, Letrec, etc? What functions do we need to have to call it a usable Erlang?
But seriously folks. Languages that generate byte-codes are probably the best kind to port to Propeller. Pascal, Java 1.1, Z80 (assembly instructions), and others were all pretty easy to do in PASM because they use an intermediate byte-code model. I don't know forth or how it operates, but I'm sure it works great for those who are attached to it and probably use it exclusively. It's not clear what Erlang does, but the specs I've seen posted don't really tell anything about the implementation.
Now, one thing you could do since the language appears to be written with GNU C is try to compile it with ZOG's GNU toolchain. The problem will be getting a ./configure output that would be usable with ZOG. I have no idea if there is a cross compile option available for zylin's ZPU ... I haven't seen any configure script in the toolchain or install directories.
Unfortunately its in a commercial app otherwise I would be happy to share the node code. What I can tell you is we created an I2C linked-in driver and use the Erlang node as the master with the porps as slaves.