General purpose language for building DSLs, especially for scientific computing.

Morfa is a general purpose programming language which enables custom Domain Specific Language (DSL) creation. It aims at combining fast and robust development of large systems with high expressiveness and performance.

  • statically typed with type inference for variables
  • JIT compiled and fast
  • user-defined operators
  • object-oriented, functional and generic programming

Morfa is presently used to develop a suite of toolboxes for scientific computing which use natural mathematical syntax. This suite includes toolboxes and Domain Specific Languages for matrix manipulations and linear algebra, optimization, ODE's and others.

import concurrent.csp;
import morfa.io.print: printf;
import morfa.util.Slice;

const PoisonValue = -1;

func Sieve(p: int, input: Channel<int>, output: Channel<int>): void
{
    var n: int;
    var next: Channel<int>;
    printf("{%d}, ", p);
    
    while(true) 
    {
        input?n;

        if (n == PoisonValue)
        {
            if (next != null)
	        next!n; 
    	    return;
        }

        if (n % p != 0)
        {
            if (next == null)
            {
		next = new Channel<int>;
                spawn(Sieve^(n, next, output));
            }
            next!n;
        }
    }
}

func main()
{
    var output = new Channel<int>;
    var input = new Channel<int>;

    spawn(Sieve^(2, input, output));
    for (i in 3..1000)
        input!i;
    input!PoisonValue;
}
Information updated 09/22/15
View Comments