TLMP programmer guide

We are introducing here TLMP programming. You must know the C++ language to use TLMP.

NEW

Using tags

The TLMP system is mapped over standard C++. The TLMP constructs are presented with HTML like tags. This was done for various reasons:

  • Tools to manipulate the tree structure of a program must work even if the underlying C++ is broken (A { is missing). The tledit editor is one of those. It can show the high level tree structure of a program directly and manipulate the code at this level.
  • It is easy to parse, so the implementation of tlcc (the TLMP to C++ translator) is a simple project.
  • It is somewhat readable. You can use any editor to write TLMP code.

So TLMP tags are generally working like this

<tag>
....
</tag>

<tag parameter>
...
</tag>

TLMP tags

NEW

Tag list

Here are the tags used by TLMP:

NEW

One little example

here is a little code snippet to get started.


#include <stdio.h>

<mod>
int main (int argc, char *argv[])
{
	<glocal>
	int count;
	</glocal>
	glocal.count = 0;
	<call loadfile>("/tmp/file",true);
		<f oneline>
			glocal.count++;
		</f>
		<f empty>
			printf ("The file is empty\n");
		</f>
	</call>
	return 0;
}
</mod>

One little example

This little program counts the number of lines in a text file and print a message if the file is empty. NEW

Tag definition

call

The call tag executes a component. It expects a single parameter: the name of the component (the function to call). In general a "call" tag is followed by one or more "f" tags and then a closing "call" tag.

The component is a C++ function. It receives parameters. They are supplied using normal C++ syntax, right after the closing > of the call tag.

<call loadfile>("filename",true);
<f oneline>
	printf ("oneline: %s\n",line);
</f>
</call>

Using the call tag

Table of content
Top