@gram-data/gram-parse
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -8,3 +8,3 @@ { | ||
], | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"license": "MIT", | ||
@@ -75,4 +75,4 @@ "author": "Andreas Kollegger", | ||
"dependencies": { | ||
"@gram-data/gram-ast": "^0.2.7", | ||
"@gram-data/gram-builder": "^0.2.7", | ||
"@gram-data/gram-ast": "^0.2.8", | ||
"@gram-data/gram-builder": "^0.2.8", | ||
"moo": "^0.5.1", | ||
@@ -83,3 +83,3 @@ "nearley": "^2.19.7", | ||
}, | ||
"gitHead": "68f323250363f0ab629388565880339d5c94ed5e", | ||
"gitHead": "3d28a7b7186d406e75bfd22aac54cd1b4ba0dbfa", | ||
"publishConfig": { | ||
@@ -86,0 +86,0 @@ "access": "public" |
@@ -1,26 +0,32 @@ | ||
# Gram Parse | ||
From text literal `(a)-->(b)` to an gram AST. | ||
From text literal `(a)-->(b)` to an abstract syntax tree for data graphs. | ||
## How to gram-parse | ||
### Install: | ||
## Install | ||
``` | ||
npm install @gram-data/gram-parse | ||
``` | ||
### Parse text into an AST: | ||
``` | ||
npm install @gram-data/gram-parse` | ||
import { toAST } from '@gram-data/gram-parse'; | ||
const src = '(a)-->(b)'; | ||
const parsed = toAST(src); | ||
``` | ||
## Parse a gram | ||
### Inspect AST using [unist-util-inspect](https://github.com/syntax-tree/unist-util-inspect): | ||
``` | ||
import | ||
const inspect = require('unist-util-inspect'); | ||
const src = `(a)-->(b)` | ||
const parsed = | ||
console.log(inspect(parsed)); | ||
``` | ||
Provides: | ||
## Next Steps | ||
- gram.ne: a grammer written in [Nearley](https://nearley.js.org) | ||
- gram-parser-plugin: a plugin for the [unified](https://unifiedjs.com/explore/package/unified/) text processing framework | ||
- toAST: a convenience function for parsing text to AST | ||
- Transform to js objects using [[gram-value]] | ||
- Write back to a string using [[gram-stringify]] | ||
- Introspect the AST using [[gram-ast]] |
706426
33
Updated@gram-data/gram-ast@^0.2.8