From text literal (a)-->(b)
to a gram AST.
How to gram-parse
Install:
npm install @gram-data/gram-parse
Parse text into an AST:
import { toAST } from '@gram-data/gram-parse';
const src = '(a)-->(b)';
const parsed = toAST(src);
unist-util-inspect:
Inspect AST usingconst inspect = require('unist-util-inspect');
console.log(inspect(parsed));
Next Steps
- Transform to js objects using [[gram-value]]
- Write back to a string using [[gram-stringify]]
- Introspect the AST using [[gram-ast]]