naru SourceForge.net Logo

Description

libnaru is a library that supports you in defining a type system for a programming language. It is thought to be another lego piece beside lexical and syntax analysis in a compiler project. The public addressed by libnaru are people that already have some experience in mapping of programming languages. Libnaru introduces a notion of scope that is part of all definitions and queries. You define your type system by type identifiers, deduction rules from one type to another and tuples of types. The resolving of expressions is seen as finding the unifier of your query expression to any defined type tuple with minimal costs. The costs of a unifier is the sum of costs of the type deduction rules used for it. The expensive minimal costs path search is considered to be doable with reasonable performance under the assumption that the first types of a tuple are reducing the search space a lot. If the type system of your source language is mappable in this form then things like multiple class or interface inheritance, global and local namespaces, privilege levels of access and even generics (though recursion needed in a meta language has to be provided outside) come into your hands. The name libnaru comes from the Finish word "naru" that means string. The reason for this choice is that the results of a resolved expression are sequences of constructor functors you defined with your type, rule and tuple definitions. You build the mapped result of the expression in the target language by iterating over the elements of these strings and doing some mapping defined by the visited constructors.

Project Status

The project is pre-alpha. That means it has not been tested except for trivial cases and documentation with examples is missing.
See the sourceforge project page for details.

Download

There is no download yet, except checking out the SVN repository (https://libnaru.svn.sourceforge.net/svnroot/libnaru).
View repository at SVN libnaru

Documentation

There is no documentation available yet except the doxygen generated view of the header file naru.h.
For having an idea how it works you can take a look at the test program tests/test_naru.c in the SVN repository. Better documentation and examples will follow.

Next steps

Author

Patrick Frey