Data front-end for your program

Transd is a language for creating data processing extensions to programs.

1 simple 2 powerful 3 compact

What tasks can Transd solve?

Extending or customizing the functionality of programs by the end user; processing data sets and complex configuration files; scripting the program's behaviour.

How Transd is used?

Transd can be integrated into a program as a two-file C++ library or can be bundled as an executable file.

Why Transd?

Transd is a full-fledged programming language with many advanced features. It's cross-platform, fast, and very compact: it's implemented only in two source files and doesn't have any dependencies.

Lightweight and compact programming language with static typing, classes, first class functions, data queries, generics, and much more.
5 Mb as a single executable file or 20 000 lines of code as a two-file C++ source library.

Use cases for Transd

Working with external data

Moderately large data sets can be worked with in Transd using a very small amount of code. A program consisting of several lines can read a 'CSV' file into memory and perform data queries on it, similar to SQL queries.

Example (essential code):

// read CSV file contents into 'dataStr' string
(textin dataStr fstream)

// load the data into an object of a built-in Table type
(load-table dataTbl dataStr)

// create an index on the field(s) of interest
(build-index dataTbl "Department")

// make a query
(with rows (tsd-query dataTbl 
                select: ["Department"] 
                as:     [[String()]] 
                sortby: "Department" )
    (for row in rows do
        (with recs (tsd-query dataTbl 
                select: all 
                as: [[String(), String(), Int(), String()]]
                where: (lambda Department String() (eq Department (get row 0))) 
                sortby: "Salary" 
                limit: 2)
            (for rec in recs do (textout rec "\n"))))) 

Full code for this example can be found here.

Handling a simple configuration file

Programs requiring simple configuration can use Transd for processing config files with minimum of coding. The configuration file(s) for such program can be organized in the form of named sections with lists of name/value items:

network : {
    siteName: "localhost",
    requestPassword: true

users : {
    usernames: ["alice", "bob", "tom"],
    userquotas: [35, 35, 30]

Such format has built-in support in Transd and can be processed with almost no customization. Values in name/value pairs can be strings, integers, floats, booleans, and lists of these. Transd reads and validates configuration files and returns the processed results via C++ API or standard output.

Handling an advanced configuration

Cases of complex configuration may include definition of custom user classes, using types, variables and expressions in config files, and definition of custom user functions that can be executed by Transd.

Complex configuration is handled by associating with configuration files a custom handler, written in Transd. The amount of code in such handler usually is considerably less, than in one written on the program's native language, thanks to the built-in support of the format in which config files are written ("Transd Structured Data" (TSD) format).

An example of handling a moderately complex configuration can be seen in a demonstration program.

Extending the program's functionality

Transd can be used for creating a library of user-defined functions, extensions, add-ons, plugins.

With Transd as an extension language, the user is able to write their own functions from scratch or download a third party's add-on and run it either via interpreter, or internally, in case if Transd is included in the program as a C++ library.

An example of extending a graphics program with a rendering function written in Transd can be found here.

Cross-platform scripting language

Transd can be used as a cross-platform general-purpose programming language for performing various programming tasks in cases when other dependencies are maybe too big, or not cross-platform, etc.

An example of using Transd as a cross-platform general purpose language is simply a Transd interpreter: FREND.

Highlights of Transd programming language