TM language

used by the DIagram ANAlyser Diana.


Similar to the TeX language, all lines without special escape - characters ("\") are simply typed to the output file. So, to type "Hello, world!" in the file "hello" we may write down the following program:
\program
\setout(hello)
Hello, world!

The asterisk in the beginning of line is a comment:

* This is the comment!

Each word, the first character of which is the escape character, will be considered as a command. This feature makes this language very easy-to-use.

Diana's preprocessor is run on the TM program before actual compilation. It permits the user to do textual substitutions (with parameters), to perform conditional compilation, etc. For example, the following preprocessor directive

\DEF(macroname)
. . .
\ENDDEF
sets the macrodefinition. After this directive you can just write
\macroname()
to invoke the macro. You can use macros with arguments:
 
\macroname(a,b,c)
In the macro body the arguments are available by the directive
\#(n)
, where "n" is the position of the argument. The argument "0" is the macro name, all extra arguments are empty strings.

Example:

only interpret
\begin translate
\DEF(EXAMPLE) 0=\#(0),1=\#(1),2=\#(2),3=\#(3)\ENDDEF
\program
\offblanklines
\setout()
\EXAMPLE(a,b)
\end translate
The result is:
 0=EXAMPLE,1=a,2=b,3=

Using macros we are able to create a high level macrolanguage similar to LaTeX, which is the set of macrodefinitions under TeX. The basic idea is again similar to LaTeX, namely the use of styles. Instead of complicated TM programming one can use proper styles. The style file containing all macrodefinitions is just included in the beginning of the TM program. We have several such styles oriented to the use of FORM.