Embedded ML?

[I think I got onto this via some LtU comment that I can't find now.] Looks like MML has been given real legs via a compiler in Haskell. Per chance, has anybody used this? Now if only there were a debugger, and good concurrency support...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Embedded ML seems to now

A different Embedded ML seems to now have a Sourceforge project. It outputs C, and can target the Arduino and Gumstix embedded platforms. Seems like there was some recent activity, though it's not clear whether the project is still kicking.

[Edit: the thesis describing the language and the compilation process to C is in the author's thesis.]

Thesis link broken

This one works for me.

Odd, your link is broken for

Odd, your link is broken for me, but the one I provided still works.

Heh, neither link works for

Heh, neither link works for me.

Hmm, it's not because I'm

Hmm, it's not because I'm signed into my Sourceforge account, as I tried this from a separate browser that I never use, and my link still works. The thesis title is, "Functional programming for embedded flight software development". I couldn't find any other references to it on the web.

also, mincaml

mincaml for fun and ???, profit!

Embedded ML

Hi naasking,

I'm the maintainer of the Embedded ML sourceforge project that you're referring to. I think I've fixed the link to my thesis, but I'm not an expert using the new sourceforge interface. Let me know if you still have troubles getting it.

The Embedded ML compiler was developed by the POP group at CMU. My contribution was the development of two new backends, one to generate C and one to generate Forth. So firstly, I am not an expert in programming languages. I am an embedded software developer by trade. I was at CMU getting an M.S. from the Robotics Institute at the time I wrote the thesis. I am currently just an amateur enthusiast of programming languages :).

The summer before arriving at CMU, I had followed along Simon Peyton Jone's great book "Implementing functional languages: a tutorial", and got a G-machine interpreter running on a Forth machine and really caught the bug of programming languages at that point.

The problem was that I couldn't find a functional programming language that would compile cleanly down to something executable on small platforms. A lot of the programming languages I'd tinkered with, like Haskell, had big runtimes that a mere mortal like myself had difficulty tinkering with.

When I got to CMU, I began talking to folks and decided to make programming languages part of my M.S. thesis, especially since the developers of this compiler were grad students at CMU who were very friendly and (one in particular) gave me hours of help and advice about how to go about modifying the compiler to add the new backends for C and Forth.

In some sense the compiler is a "toy", being built as something of a side project by a couple grad students. It compiles something very similar to Standard ML, but without modules, for example. I'm not sure why but I believe those unnamed grad students had some dislikes of them :). And also, one of them was rumored to hate underscores, so dashes became legal characters in variable names. I think there are a couple of other quirky things that make it differ from Standard ML.

Despite being called a toy, the compiler has compiled a substantial amount of code, including the "codex" of the 2006 ICFP programming contest. As another example, I just published a paper on a functional implementation of something called the Asynchronous Message Service (AMS) for the Space Mission Challenges in Information Technology conference this year. AMS is basically a peer to peer network protocol for space applications. I would provide a link to the paper but it's published by the IEEE Computer society and I think I'm bound by copyright not to release it, or something like that. The paper talks about the use of first class functions, continuations, and parametric types in combination to implement the "active object" pattern that is quite convenient for implementing concurrent applications, and I compiled all of the software with this compiler.

The only person to ever contact me about the project got something running on a Nintendo DS, but he got discouraged by the lack of a module system. Another one of his complaints was that a syntax error can cause the compiler to just spit out a terse "parse error", that doesn't give you much help at all. To tell the truth I don't know how to go in and provide better compiler warnings. Parsing, etc, is not my strong suit.

I hope this helps introduce to the project (and its quirks), so that maybe you don't have to spend the time downloading it to try it out if you don't like it already. In addition, maybe you won't have to get buried by my 70 page thesis now :)

take care,
-andrew

Embedded ML

Oh -- and I wanted to mention that it does not actually support the Arduino. The compiler makes some assumptions about 32-bit-ness, and I think that would cause troubles with the Arduino (since it's based on the 8-bit Atmega 168). In addition, I don't think the Arduino has enough RAM to support a decent sized heap.

-andrew

Thanks for the detailed

Thanks for the detailed analysis! Could have sworn I read something about the Arduino on the Sourceforge pages; your thesis mentions the Atmega chipset, so maybe that's where I got it from...

In any case, your Embedded ML is an interesting tradeoff in the space of ML implementations, and in an area that's rather lacking. Your thesis looks like it covers some interesting ML features and how they map to C, like continuations and exceptions, so it's of interest to some people.