Skip to main content

Convenience wrapper for exonware-xwsyntax - provides 'import xwsyntax' alias

Project description

xwsyntax

Bidirectional grammars: parse text to an AST, emit text again, or hop formats by reusing the same tree (for example JSON in, SQL out). 100+ grammars (300+ files) covering query languages, data formats, and code. Used by xwquery and editor/Monaco flows.

Company: eXonware.com · Author: eXonware Backend Team · Email: connect@exonware.com

Status Python License


📦 Install

pip install exonware-xwsyntax
pip install exonware-xwsyntax[lazy]
pip install exonware-xwsyntax[full]

Runtime deps are declared in pyproject.toml (lark, exonware-xwsystem, exonware-xwnode, exonware-xwlazy wiring). See docs/GUIDE_01_USAGE.md for modes and troubleshooting.


🚀 Quick start

from exonware.xwsyntax import BidirectionalGrammar

grammar = BidirectionalGrammar.load('json')
ast = grammar.parse('{"name": "Alice", "age": 30}')
json_str = grammar.generate(ast)

sql_grammar = BidirectionalGrammar.load('sql')
sql = sql_grammar.generate(ast)

Facade: XWSyntax().parse(text, format_name) or validate(text, format_name).
Discovery: list_grammars_quick(), load_grammar_quick(name).
More code paths: REF_14_DX, API: REF_15_API.


📄 Examples

Facade parse/validate

from exonware.xwsyntax import XWSyntax

engine = XWSyntax()
ast = engine.parse("a = 1 + 2", format_name="python")
is_valid = engine.validate("a = 1 + 2", format_name="python")

List and load grammars

from exonware.xwsyntax import list_grammars_quick, load_grammar_quick

names = list_grammars_quick()
grammar = load_grammar_quick(names[0])

JSON to SQL via shared AST

from exonware.xwsyntax import BidirectionalGrammar

ast = BidirectionalGrammar.load("json").parse('{"name": "Alice", "age": 30}')
sql = BidirectionalGrammar.load("sql").generate(ast)

✨ What you get

Area Contents
Read/write Grammar-driven parse and generate; avoid hand-maintained per-format maps.
Bidirectional Round-trip or cross-syntax by swapping grammars on the same AST.
Large grammar set SQL, Cypher, GraphQL, xwqueryscript, configs, programming languages, markup, storage dialects; 300+ .lark / .json assets.
Downstream xwquery parsing; Monaco export and codec hooks via xwsystem.

Phase: Alpha. Milestones: REF_22_PROJECT.


📖 Docs and tests


📜 License and links

MIT - LICENSE.
Homepage: https://exonware.com · Repository: https://github.com/exonware/xwsyntax

⏱️ Async Support

  • xwsyntax is primarily synchronous in its current implementation.
  • Source validation: 0 async def definitions and 0 await usages under src/.
  • This module still composes with async-capable xw libraries at integration boundaries when needed.

Version: 0.6.0.28 | Updated: 25-Apr-2026

Built with ❤️ by eXonware.com - Revolutionizing Python Development Since 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xwsyntax-0.6.0.29.tar.gz (217.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xwsyntax-0.6.0.29-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file xwsyntax-0.6.0.29.tar.gz.

File metadata

  • Download URL: xwsyntax-0.6.0.29.tar.gz
  • Upload date:
  • Size: 217.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xwsyntax-0.6.0.29.tar.gz
Algorithm Hash digest
SHA256 85c3dfc7ee31f4e61a3c9d9cc5276a2d3dc31e0448bc66915fd7100a1036b20e
MD5 4deede8819720d5a3a29389f908b2b35
BLAKE2b-256 6e8e11ae3a8e4d55c3c9e3bae88e8b37603ddedf7a68fbca968afe676035fd42

See more details on using hashes here.

File details

Details for the file xwsyntax-0.6.0.29-py3-none-any.whl.

File metadata

  • Download URL: xwsyntax-0.6.0.29-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for xwsyntax-0.6.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 b69f21f5db3ca479ba183a7bcdaf8669b83c1b1b46a73f437c7b692cbc1903a0
MD5 a0d621c4e7a6512c6479cddbfa36f1ac
BLAKE2b-256 5c00acd8f9300843bc7d472312cd0100ac02524a41a6e1f9644c7d967d22898d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page