Skip to content
Provide a reference implementation for the TTM programming language.
C Java Python Other
Latest commit 8dfcf5f Oct 4, 2014 dmh 1. modified to properly handle escaped characters.
2. tested that the code can work without memmove
   and fixed a resulting error.

Project Description

The goal of the ttm project is to provide a reference implementation for the TTM programming language.

TTM is a form of macro processor similar to TRAC, GAP, and GPM.

Syntax and Semantics

It is assumed that TTM is given a text file containing some combination of ordinary text and TTM function calls (i.e. invocations). The text is scanned character by character. Any ordinary text is passed to the output unchanged (except when escaped). If a TTM function is encountered, it is collected and executed. The general form of a TTM function call looks like this.


where the functionname and the arguments are arbitrary character strings not characters of significance: '#', '<', '>', and ';'. The function is invoked with the specified arguments and the resulting text is inserted into the original text in place of the function call. If the function call was prefixed by a single '#' character, then scanning will resume just ''before'' the inserted text from the function call. If the function call was prefixed by two '#' characters, then scanning resumes just ''after'' the inserted text.

During the collection of a function call, additional function calls may be encountered, for example, this.


The nested function call will be invoked when encountered and the result inserted into the text of the outer function call and scanning of the outer function call resumes at the place indicated by the number of '#' characters preceding the nested call.

If a function takes, for example, 2 arguments, any extras are ignored. For user defined functions, if too few arguments are provided, additional one are added with the value of the empty string ("").

As with other applicative programming languages, a TTM function may be recursive and may be defined as the result of the invocation of a sequence of other function calls.

Functions are either ''built-in'' or user defined. A large number of built-in functions exist and are defined in the TTM reference manual.

External Links

Something went wrong with that request. Please try again.