Skip to content

Getting Started

Installation

Include the header file:

#include "ast.hpp"

Requires only RapidJSON as a dependency.


Building a Simple Report

Node report = div({
    h1({ text("Energy Report") }),
    p({ text("Summary of daily power usage.") })
});
std::cout << stringify(report);

Output JSON:

{
  "type": "div",
  "children": [
    {
      "type": "h1",
      "children": [
        { "type": "#text", "props": { "value": "Energy Report" } }
      ]
    },
    {
      "type": "p",
      "children": [
        { "type": "#text", "props": { "value": "Summary of daily power usage." } }
      ]
    }
  ]
}