This documentation describes the Abstract Syntax Tree (AST) generated by the CDDL (Concise Data Definition Language) parser in this project. The CDDL format is defined in the RFC 8610 specification.
The parser transforms CDDL files into an Abstract Syntax Tree (AST) representation that can be further processed to generate other formats like TypeScript type definitions. This documentation explains the structure of the AST and its components.
import Parser from '../src/parser.js'
// Create a new parser instance with the path to a CDDL file
const parser = new Parser('./example.cddl')
// Parse the file and get the AST
const ast = parser.parse()
// Now you can work with the AST to generate other formats
console.log(JSON.stringify(ast, null, 2))
The AST generated by the parser consists of a series of Assignment nodes, which can be one of:
Each of these contains properties and references that form a tree structure representing the CDDL document.
See the individual documentation files for detailed information on each component of the AST.