Documentation

DML — Descriptive Markup Language

DML is a simple, JSON-like descriptive language that supports variables, arithmetic operations, nested structures, lists, and maps. It was created using Kotlin, ANTLR, and the Java Virtual Machine.

Think of it as a strongly-typed, comment-friendly version of JSON — built for configuration, definition, and readability.


Features


Installation

Coming soon: Homebrew Tap to install globally

brew tap tree-software-company/dml
brew install dml

Then you can use it globally like:

dml -r dml test.dml

The Homebrew formula downloads the .jar from GitHub Releases, verifies its SHA-256 checksum and runs it with the Homebrew-managed openjdk@17.


Option 2: Manual Installation (Local Development)

1. Clone the repo and build the .jar

git clone https://github.com/tree-software-company/dml.git
cd dml
gradle build

After build, you'll find your CLI JAR at:

build/libs/DML-all.jar

2. Run the CLI

java -jar build/libs/DML-all.jar -r dml test.dml

3. (Optional) Make it global

Create a wrapper script:

sudo nano /usr/local/bin/dml

Paste:

#!/bin/bash
exec /path/to/jdk-17/bin/java -jar /path/to/DML-all.jar "$@"

Then make it executable:

chmod +x /usr/local/bin/dml

Now you can run:

dml read file.dml

4. Verify a downloaded .jar

A .jar downloaded from GitHub Releases runs with the full permissions of your user. Compare its checksum with the sha256 pinned in the Homebrew formula before running it:

shasum -a 256 DML-all.jar

Do not run a .jar whose checksum differs.

Example DML Code

string title = "Hello";
number age = 30 + 2;
boolean isActive = true;

list numbers = [1, 2, 3, 4];
map user = { "name": "Szymon", "email": "example@example.com" };

string message = "Welcome, " + user.name;

Output:

Variables: {
  title=Hello,
  age=32,
  isActive=true,
  numbers=[1, 2, 3, 4],
  user={name=Szymon, email=example@example.com},
  message=Welcome, Szymon
}

Configuration Files (.env)

A DML program can read values from a .env file that lies in the project directory (the directory of the executed .dml file or below it).

.env:

DB_HOST=localhost
export DB_PORT="5432"
API_KEY=top-secret # inline comment

app.dml:

loadEnv(".env");

string host = env("DB_HOST");
string port = env("DB_PORT", "1111");
string region = env("REGION", "eu-west-1");
private string apiKey = env("API_KEY");

Modes (dev / prod)

A DML file can keep the values of several environments side by side in mode blocks. Only the block of the selected mode is executed.

app.dml:

string app = "tree";

mode dev {
    string db = "localhost";
}

mode prod {
    string db = "prod.db.server";
}
dml -r dml app.dml --mode prod

Output:

app = tree
db = prod.db.server

CLI Commands

Command Description
dml -r dml FILE Executes and interprets a .dml file
dml -r dml FILE --mode NAME Executes a .dml file with the mode NAME blocks (-m NAME)
dml -r json FILE Convert .json file for .dml file
dml -r yaml FILE Convert .yaml file for .dml file
dml -r xml FILE Convert .xml file for .dml file
dml -r plist FILE Convert .plist file for .dml file
dml -r properties FILE Convert .properties file for .dml file
dml -w json FILE Convert .dml file for .json file
dml -w yaml FILE Convert .dml file for .yaml file
dml -w xml FILE Convert .dml file for .xml file
dml -w properties FILE Convert .dml file for .properties file
dml -w plist FILE Convert .dml file for .plist file
dml -l FILE Check if .dml file will validate
dml -f FILE Make .dml code more beauty
dml -e 'EXTENSION' FILE Create code from terminal
dml -n FILE Create a new DML file with a template
dml -h or dml --help Shows help menu
dml -v or dml --version Shows lang version
dml -u or dml --update Update DML via Homebrew

Development

This project uses:


License

This project is licensed under the Apache 2.0 License.


Author

Developed by Tree