martinevald.net

MinTPL (GitHub)

Minimal Template Programming Language

Description

A minimalistic language for automatic text processing, implemented as a C (17) library for embedding. It is made specifically to be extended by the embedding application. As a language it bears some similarities to Tcl.

Example

File: input.mtpl

Have a look at this [for>[=>adjectives] adj {[=>adj], }]example.

Invokation using mintpl-cli:

$ mintpl-cli -p adjectives="small;silly" input.mtpl
Have a look at this small, silly, example.

For more examples, see the examples folder.

Features/characteristics

Known omissions/Future improvements

Building/installing

The project is built using CMake (version 3.5 or higher).

  1. Create a build directory (preferrably named build) in the repository root.
  2. From within the build directory, issue cmake .. -DCMAKE_BUILD_TYPE=Release.
    • To create a debug build, change CMAKE_BUILD_TYPE to Debug.
    • To build a shared library, set the SHARED_LIBRARY variable from the command line: cmake .. -DCMAKE_BUILD_TYPE=Debug -DSHARED_LIBRARY=1
  3. A project will now have been generated, based on whatever build system is the platform default. Build and install as you most commonly would (if in doubt, type make).
  4. Upon successful completion, the library file will be located directly within the build directory.
    • Tests can be run by invoking the executables in the tests subdirectory.
    • There’s a proof-of-concept standalone tool in the standalone folder, called mintpl-cli. It can be used to process templates that only make use of built-in generators.
  5. To install, build the install target, with superuser privileges if necessary. This will install both the library and a pkg-config recipe. On Linux you may need to run ldconfig after installing.

License

MinTPL is released under the MIT License.