C and C++ Programming Resources

Custom Search

Common Text Transformation Library

Common Text Transformation Library, CTTL for short, is a set of C++ classes and functions to understand and modify text data. The library implementation is based on STL classes and algorithms.

The library provides components for creating lexical analyzers making practical use of EBNF grammars. Template meta-programming and operator overloading offer features to write expressions that describe EBNF grammar rules directly in C++. No additional steps of parsing, compiling, or source code preprocessing are required. Compiled CTTL program implements LL(INF)-parser, the recursive-descent parser with infinite lookahead.

CTTL lexer generates a stream of substrings that correspond to parsed tokens. Substrings can be compared, inserted, deleted, or replaced without restrictions. CTTL substrings remain stable when content of the underlying string changes. Substring boundaries are adjusted according to the positional shifts of inserted or deleted text.

The library formalizes concept of text transformation as a series of mutating operations on substrings, executed in any order. More specifically, text transformation becomes first-hand operation during grammar evaluation. Since EBNF grammar productions are recursive by definition, text-manipulating programs can also be written as recursive algorithms.

CTTL distribution includes only C++ headers and sample source files. The library is header-only: the header files contain template classes and functions, which do not require separately-compiled binaries. No installation or other special treatment is needed.

Download and enjoy Common Text Transformation Library!

Tags: , ,

There are No Comments to this post. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response


Leave a Reply

You must be logged in to post a comment.