The World's Fastest AST Processor - 50-3000x faster than unified
- ⚡ 50-3000x faster than unified/remark
- 🌍 Universal AST - Same interface for 19+ languages
- 🔄 Incremental parsing - <1ms response time, 99%+ token reuse
- 📦 Zero dependencies - Minimal bundle size
- 🛠️ Rich tooling - Formatters, minifiers, linters, metrics
npm install @sylphx/synth @sylphx/synth-mdimport { 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('Heading level:', ctx.node.data?.depth),
strong: (ctx) => console.log('Found bold text')
})
// Get source text from any node
const heading = tree.nodes[1]
const source = tree.meta.source.slice(
heading.span.start.offset,
heading.span.end.offset
)All languages share the same BaseNode interface:
interface BaseNode {
id: number // Unique ID
type: string // 'heading', 'paragraph', etc.
span?: { // Source location
start: { line, column, offset }
end: { line, column, offset }
}
parent: number | null // Parent node ID
children: number[] // Child node IDs
data?: Record<string, unknown> // Language-specific data
}| Category | Languages |
|---|---|
| Markup | Markdown, HTML, CSS, JSX, Vue |
| Programming | JavaScript/TypeScript, Python, Go, Rust, Java, PHP, Ruby, C |
| Data | JSON, YAML, TOML, INI, XML |
| Query | SQL, GraphQL, Protocol Buffers |
| Operation | Synth | unified | Speedup |
|---|---|---|---|
| Parse 1KB | 0.001 ms | 0.10 ms | 92x |
| Parse 3KB | 0.005 ms | 0.58 ms | 520x |
| Parse 10KB | 0.03 ms | 3.50 ms | 3154x |
📚 Full Documentation (coming soon)
@sylphx/synth- Core types, traversal, query index
@sylphx/synth-md- Markdown (CommonMark + GFM)@sylphx/synth-js- JavaScript/TypeScript@sylphx/synth-html- HTML5@sylphx/synth-json- JSON@sylphx/synth-yaml- YAML@sylphx/synth-css- CSS3- View all packages...
@sylphx/synth-js-format- JavaScript formatter@sylphx/synth-js-minify- JavaScript minifier@sylphx/synth-lint- Universal linter@sylphx/synth-metrics- Code metrics
# Install dependencies
bun install
# Build all packages
bun run build
# Run tests
bun run test
# Run docs locally
bun run docs:devMIT