Skip to content

Emerging Languages Camp Part 4: Nimrod and Dao

This is the fourth post of my notes from Emerging Languages Camp last year. If you haven’t seen it already, you might want to read the Introduction to this series.

Nimrod: A new approach to meta programming

Andreas Rumpf

Homepage · Slides · Presentation

Nimrod’s creator, Andreas Rumpf, describes the language as a statically typed, systems programming language with clean syntax and strong meta-programming. It compiles to C. He said it had a "realtime GC," but if you look at the Nimrod release notes, you will see that it does not do cycle detection unless you enable the mark and sweep GC, and that the mark and sweep GC is not realtime. Interestingly, use of the GC is optional and the compiler removes it if you do not use it. The compiler, IDE, and package manager are all self-hosted.

My favorite slide title from this presentation (or possibly all of ELC) was "Optimizing Hello World (4)". And yes, there were three preceding slides in that series.

Andreas noted that:

echo "hello ", "world", 99

…is rewritten to:

echo([$"hello ", $"world", $99])

(where $ is Nimrod’s toString operator.) Andreas said that this does not require dynamic binding. It seems like the compiler does a lot of rewriting. Andreas said that side effect free methods might be evaluated at compile time. There is also a macro system, which appears hygienic. The slideshow has a nice example of using the template system to implement a simple DSL for HTML templating, along with the rewriting performed by the compiler on the output of a template expansion, which eventually boils down to a single string with the final HTML.

This presentation provided food for thought on what the boundaries should be between compiler rewriting and the use of library templates or macros. There’s certainly some gray area between these two.

Dao Programming Language for Scripting and Computing

Limin Fu

Homepage · Slides · Presentation

Dao is a optionally/implicitly typed language motivated by the author’s frustration with Perl and desire for a better programming language for bioinformatics. True to this origin, much of the language’s optimization is numerically-focused. There is an LLVM-based JIT and a C interop system. There is an unhygienic macro system based on EBNF specifications.

And more! Want mixins? Aspects? Async?  It’s in there.

The async feature, interestingly, is specified at the call site:

routine SumOfLogs( n = 10 )
{
    sum = 0.0
    for( i = 1 : n ) sum += log( i )
    return sum
}

fut = SumOfLogs( 2000000 ) !!    # Asynchronous mode;
while( fut.wait( 0.01 ) == 0 ) io.writeln( ’still computing’ ) io.writeln( ’sum of logs =’, fut.value() )

Here, the !! means "run this asynchronously."

In the next post in this series I’ll discuss Walter Wilson’s presentation on Axiomatic Language.

{ 2 } Comments

  1. Mason Wheeler | June 6, 2014 at 4:57 pm | Permalink

    Interesting stuff about Nimrod. Looking at it on its site, it looks like someone took Boo and said "let’s take out the CLR dependency and make this compile to native code instead." (That’s just a cursory overview, of course, but that’s my first impression.)

  2. Joseph G. Mitzen | June 7, 2014 at 1:35 am | Permalink

    I’m disappointed you didn’t cover the degree to which Nimrod actually borrows from Pascal/Delphi, including the venerable old "Type" section. It’s something of a mashup of Delphi and Python (Mason mentions Boo, which was basically designed as a statically typed Python).

Post a Comment

Your email is never published nor shared. Required fields are marked *

Bad Behavior has blocked 713 access attempts in the last 7 days.

Close