Chaperon is a project that converts structured text to XML. It includes a strong LALR(1) parser to parse the text and a tree builder, which creates an XML document.

What is it?

Chaperon is a lexical scanner, a parser generator, a parser, a tree builder and an XML generator all in one package. Chaperon can parse structured text using a grammar and then generate an XML representation of the parsed text, so it is easy to use Chaperon as a converter for text files.

What is structured text?

Examples of structured text are TeX files, java files, config files, etc.


This project contains two ANT tasks to create the parse table and to parse text documents. There are also Generator/Transformer componenets for Apache Cocoon 2.


I started this project in 2000 in order to learn more about parser generators. I started with an implementation of an SLR parser. Much of the literature which I read came from online courses. Later I had the idea to use XML as output so I could transform the output via XSLT stylesheets. Now I can use my parser to parse text without programming, which makes it very simple.

by Stephan Michels