dmltools

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: GPL-2.0

README

dmltools

Go Version Go Reference Release Supported DML Versions CI

Tooling and utilities for Device Modeling Language (DML 1.4), including dmlfmt (an opinionated deterministic code formatter).

Installation

Via go install

With Go 1.23+ installed:

# Install the dmlfmt code formatter
go install github.com/timoschenko/dmltools/cmd/dmlfmt@latest

# Install the dmlast AST dumper
go install github.com/timoschenko/dmltools/cmd/dmlast@latest
Prebuilt Binaries

Precompiled binaries for Linux (amd64, arm64) and Windows (amd64) are available on the GitHub Releases page.

Building from Sources

Clone the repository and build using GNU Make:

git clone https://github.com/timoschenko/dmltools.git
cd dmltools
make release

Note: Building directly on a Windows host is not yet supported (use WSL2, Linux, or macOS).

For detailed build instructions, code generation, dependencies, and running tests, see BUILD.md.

dmlfmt

An opinionated, deterministic code formatter for Device Modeling Language (DML).

Usage
# Format files or directories in place:
dmlfmt path/to/file-a.dml path/to/file-b.dml
dmlfmt --line-length 120 src/

# Format a snippet
dmlfmt --code "method foo() -> (bool) { return 42; }"

# Check formatting without modifying files:
dmlfmt --check src/

For formatting rules and style specifications, see the DML Code Formatting Guide.

License

This project is licensed under the GNU General Public License v2.0 only - see the LICENSE file for details.

Directories

Path Synopsis
cmd
dml-web-format command
dmlast command
dmlfmt command
pkg
dmlex
Package dmlex provides lexing, parsing, and AST representations for the Device Modeling Language (DML 1.4 & 1.2).
Package dmlex provides lexing, parsing, and AST representations for the Device Modeling Language (DML 1.4 & 1.2).
fs
Package fs provides file system utilities, safe atomic file writing, path normalization, and buffer sizing heuristics for DML tooling.
Package fs provides file system utilities, safe atomic file writing, path normalization, and buffer sizing heuristics for DML tooling.
fs/stream
Package stream provides streaming buffers, composite hashing, and ANTLR character stream implementations for cached file processing.
Package stream provides streaming buffers, composite hashing, and ANTLR character stream implementations for cached file processing.
printer
Package printer provides the code formatting engine for Device Modeling Language (DML).
Package printer provides the code formatting engine for Device Modeling Language (DML).
printer/dml_defaults
Package dmldefaults provides baseline token formatting tables, expression rules, and C-declaration formatting configurations for the DML formatter.
Package dmldefaults provides baseline token formatting tables, expression rules, and C-declaration formatting configurations for the DML formatter.
printer/format
Package format defines token formatting primitives, Unified Formatting Flags (UFF), spacing separators, break priorities, and JSON serialization support for the DML formatter.
Package format defines token formatting primitives, Unified Formatting Flags (UFF), spacing separators, break priorities, and JSON serialization support for the DML formatter.
printer/layout
Package layout provides token buffering, conflict resolution, line wrapping, indentation management, and stream emission for the DML formatter.
Package layout provides token buffering, conflict resolution, line wrapping, indentation management, and stream emission for the DML formatter.
test

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL