Skip to content

SynthThe World's Fastest AST Processor

50-3000x faster than unified. Zero dependencies. Universal AST.

Synth

Quick Example

typescript
import { parse, traverse, getNode } from '@sylphx/synth-md'

// Parse markdown (42x faster than remark!)
const tree = parse('# Hello **World**')

// Traverse the AST
traverse(tree, {
  heading: (ctx) => {
    console.log('Found heading:', ctx.node.data?.depth)
  },
  strong: (ctx) => {
    console.log('Found bold text')
  }
})

// Get source text from any node
const node = tree.nodes[1] // heading node
const source = tree.meta.source.slice(
  node.span.start.offset,
  node.span.end.offset
)
// → "# Hello **World**"

Supported Languages

Web & MarkupProgrammingData & ConfigQuery & Schema
HTMLJavaScript/TypeScriptJSONSQL
MarkdownPythonYAMLGraphQL
CSSGoTOMLProtocol Buffers
JSX/TSXRustINIMessagePack
Vue SFCJava, PHP, Ruby, CXML

Performance

OperationSynthunifiedSpeedup
Parse small (1KB)0.001 ms0.10 ms92x
Parse medium (3KB)0.005 ms0.58 ms520x
Parse large (10KB)0.03 ms3.50 ms3154x
Transform0.005 ms0.58 ms110x

Install

bash
npm install @sylphx/synth @sylphx/synth-md

Released under the MIT License.