LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

dcg

schema-driven code generator for multiple languages

TLDR

Generate code from specification
$ dcg [specification.dcg] -o [output_dir]
copy
Generate with specific language target
$ dcg [specification.dcg] --lang [go]
copy
Generate with custom templates
$ dcg [specification.dcg] --template [template_dir]
copy
Validate specification without generating
$ dcg [specification.dcg] --validate
copy
List available generators
$ dcg --list-generators
copy

SYNOPSIS

dcg [options] specification

DESCRIPTION

dcg (Data Code Generator) is a code generation tool that transforms data specifications or schemas into code for various programming languages. It automates the creation of data structures, serialization code, and related boilerplate.The tool reads a specification file describing data types and their relationships, then applies language-specific templates to generate corresponding source code. This approach ensures consistency between documentation and implementation.Code generators like dcg are valuable in projects with complex data models, multiple language implementations, or requirements for strict schema enforcement across system boundaries.

PARAMETERS

SPECIFICATION

Input specification file to process.
-o, --output DIR
Output directory for generated code.
--lang LANGUAGE
Target programming language.
--template DIR
Directory containing custom templates.
--validate
Validate specification only.
--list-generators
Show available code generators.
--help
Display help information.

CAVEATS

Generated code may require manual adjustments for edge cases. Custom templates require understanding of the template engine. Breaking changes in specifications may require regenerating all dependent code.

HISTORY

dcg represents a category of code generation tools that emerged to address the challenge of maintaining consistent data representations across multiple languages and platforms. Various implementations exist with different specification formats and target languages.

SEE ALSO

protoc(1), thrift(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid