# The L+ Programming Language

Continuing with the L+ saga, after the announcement of the free compiler release and the Fibonacci number example, yesterday we added to the project a new piece of documentation: The L+ Programming Language guide.

This guide aims to introduce the L+ language to developers. It provides the keywords reserved by the compiler, explains the data types available, the language’s constructs and the functions included in the standard library.

The document also contains the full Grammar for the L+ language, something you might find interesting whether you are interested in compiler development or just getting started with Language Theory.

The document was produced using LaTeX and the full source code has been merged into the source tree of the L+ compiler.

If you have any comments or questions, don’t hesitate to leave them below.

Posted in L+

# The Fibonacci Number: a new L+ example

I’ve just added a new example to illustrate the capabilities of the L+ language: fibo.lp

If you read our last post then, as you might recall, last Saturday we released a Free (as in Freedom) compiler called the “L+ compiler”. This program was a mandatory assignment we had to develop for a Compiler course at the Catholic University of Uruguay back in 2006.

When we introduced the compiler, we featured a simple “Hello World” program that illustrated a basic example of L+, our language. The example was very basic though, so I wanted to raise the bar and show what our little language can do.

This new program reads a number from stdin, calculates its corresponding Fibonacci number and prints the results to stdout.

The good thing about this example is that it illustrates most of L+ in action, including: I/O, function declarations, recursion, branching and string processing.

Here’s the full source code for the example. You can find it at the L+ project homepage and you also get it when you checkout the source code from Subversion.

From a compiler developer’s point of view, I can hardly tell you what it felt like seeing our compiler handling a source code as complex as this one and even catching some grammar errors every time I forgot to add a semicolon to a line.

I really encourage you to test this program, but in case you don’t, here’s the output the L+ compiler produces while compiling this program (yeah, it’s really verbose):

Finally, this is the output produced from running the program with an input value of “10”:

Posted in L+

# Introducing the L+ Compiler (and it’s free!)

I’m glad to announce that Emilio Pombo and I have just released the full source code for a custom compiler we built back in 2006!

The compiler, built as a mandatory Compilers assignment at the Catholic University of Uruguay, translates programs written in a C-like programming language, called L+, into Java Bytecode, suitable for execution on any platform with a Java Virtual Machine.

L+ supports most of C constructs (variables, branching, loops, functions, recursion, I/O), with some limitations and some additions (like native string handling). Here’s the mandatory “hello world” program written in L+.

The full source code is available as of now at google code, atÂ http://code.google.com/p/lpcompiler/.

We have licensed the L+ compiler under the GPLv3, so you are free to download, compile, study, modify and ultimately redistribute your changes to anyone. I encourage you to check out the code, build it and try the examples that come bundled, so you can see what our little language can do :)

L+ is written in pure ANSI/ISO C++ and supports GNU/Linux, Mac OS X and Microsoft Windows. Dependencies are minimal and should build on any UNIX-like environment.

I want to thank Emilio Pombo and Leonardo Val for subscribing to the idea of releasing this program as Free Software and for also encouraging me to do so.

I hope you find the project as interesting as we found it fun to write it!