LTPL - Lambda Text Processing Language

Description
Machine
Download
Notes

Language Description

LTPL is a language used for generic text processing, it relies on three data-types providing a very expressive and simple syntax. The ideia was mainly influenced by Haskell, Latex and AWK.
We have two separete parts: the defition writing language, and the markup language.

Definition writing language, LTPL

The definition writing language is very similar to Haskell. It is yet under alpha testing phase. Some examples follow:
itemwrapper {a} b = ("<li>", a, "</li>%n", (itemwrapper b))
itemwrapper {} = ""

descwrapper {x}{y}z = ("<dt>", x, "</dt>lt;dd>", y, "</dd>%n", (descwrapper z))
descwrapper {} = ""
descwrapper _ = fail

itemize x = ("<ul>%n", (itemwrapper x), "</ul>%n")
enumerate x = ("<ol>%n", (itemwrapper x), "</ol>%n")
description x = ("<dl>%n", (descwrapper x), "</dl>%n")

Some improvements needs to be done at the verbatim code output, if you look on the source code of this document you'll see why. This will be made on the comming versions. Not only verbatim needs to be improved, a lot of "under the hood" things needs some improvemt aswell.

Markup Language, LTPML

The markup language is very much alike LaTeX. Very easy to write and read (but on the verbatim mode... will be fixed soon). Some example follow:
/* Let's start with important definitions: */
\definition $title{The title of the page, will appear in the browser.}

/* Then some LTPML text follow */
\section{Testing Section}
Here we can put some text, or a list, with three elements:
\enumerate{one}{two}{three}
You can give some \bold{emphasis} on what is \italic{important} very easily.

The output of the above text, using the HTML generation library is:

Testing Section

Here we can put some text, or a list, with three elements:
  1. one
  2. two
  3. three
You can give some emphasis on what is important very easily.


By the way, this whole site was writen in LTPML, the file is available for download.

Machine Description

The machine that interprets the language is a mixture of a graph reduction machine with a finite stack automaton. The representation of the defitions is just like a normal functional program, it is represented by a tree. This tree is then reduced using a stack (not overwriting the tree structure itself), with this implementation is possible, and easy, to call the same functions anytime, without losing the data.
This implementation was needed because the definition writing language is functional, but the markup language follows a imperative/procedural paradigm, so we need to mix the two in order to achieve a correct interpretation.

Download links

THE PROJECT STILL IN ALPHA!!!!!
Download at your own risk. The code is provided under the GNU General Public License .
Project source code
to be uploaded
This site ltpml source
here
HTML ltp definitions
Syntax Highlight for GTK-SourceView 2.0

Notes

Since the project is yet being born, every aspect can change at any time. Every change will be posted here.
Victor Cacciari Miraldo - e-mail