Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@gram-data/gram-stringify

gram-data123MIT0.3.11TypeScript support: included

Pretty print gram data graphs

graph, neo4j, gram, unified

readme

From gram AST to text literal (a)-->(b).

How to gram-stringify

Install:

npm install @gram-data/gram-stringify

Build an AST using [[gram-builder]], then pretty print with gram-stringify:

import { node, edge } from '@gram-data/gram-builder';
import { stringify } from '@gram-data/gram-stringify'; 

const left = node('a');
const right = node('b');
const ast = edge([left, right], 'right');

console.log(stringify(ast));

Parse to AST using [[gram-parse]], then pretty print with gram-stringify:

import { toAST } from '@gram-data/gram-parse'; 
import { stringify } from '@gram-data/gram-stringify'; 

const src = '(a)-->(b)';
const ast = toAST(src);

console.log(stringify(ast));

Next Steps

  • Save to a file to share a gram with a friend!