Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gram-data/gram-ast

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gram-data/gram-ast - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

4

package.json

@@ -9,3 +9,3 @@ {

],
"version": "0.2.7",
"version": "0.2.8",
"license": "MIT",

@@ -69,3 +69,3 @@ "repository": {

},
"gitHead": "68f323250363f0ab629388565880339d5c94ed5e",
"gitHead": "3d28a7b7186d406e75bfd22aac54cd1b4ba0dbfa",
"publishConfig": {

@@ -72,0 +72,0 @@ "access": "public"

@@ -1,8 +0,36 @@

# Gram AST
Gram abstract syntax tree definitions and utilities like type guards.
An abstract syntax tree for data graphs.
## How to gram-ast
A [unist](https://github.com/syntax-tree/unist) compatible AST for
Gram's text literal format.
### Install:
```
npm install @gram-data/gram-ast
```
### Use [[gram-parse]] to create an AST, then introspect with gram-ast:
```
import { toAST } from '@gram-data/gram-parse';
const src = '(a)-->(b)';
const parsed = toAST(src);
// the top-level of the AST is a sequence of paths
console.assert(isGramPathSequence(parsed));
// the first path should be an edge
const firstPath = parsed.children[0];
console.assert(isGramEdge(firstPath));
// the children of an edge are nodes
console.assert(isGramNode(firstPath.children[0]));
console.assert(isGramNode(firstPath.children[1]));
```
## Next Steps
- Transform to js objects using [[gram-value]]
- Write a [unist](https://github.com/syntax-tree/unist) plugin for processing the AST
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc