Skip to main content

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

Project description

xwsyntax

One bidirectional grammar engine. Parse text to AST, generate back, or convert between syntaxes (e.g. JSON to SQL). 100+ grammars (328+ files) for query, data, and code. Powers xwquery and editors; use it to create new syntaxes or bridge formats.

Company: eXonware.com · Author: eXonware Backend Team · Email: connect@exonware.com
Version: version.py (__version__, __date__)

Status Python License


Install

pip install exonware-xwsyntax
# Optional: full extras
pip install exonware-xwsyntax[full]

Depends on xwsystem. See docs/GUIDE_01_USAGE.md for details.


Quick start

from exonware.xwsyntax import BidirectionalGrammar

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

# Convert between syntaxes
sql_grammar = BidirectionalGrammar.load('sql')
sql = sql_grammar.generate(ast)
# Same AST, different format

Facade: XWSyntax().parse(text, format_name) or validate(text, format_name).
List grammars: list_grammars_quick(), load_grammar_quick(name).
Key code: REF_14_DX · API: REF_15_API.


Examples

Parse and validate with the facade

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 grammars and load by name

from exonware.xwsyntax import list_grammars_quick, load_grammar_quick

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

Convert JSON to SQL by reusing the 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 Description
Grammar read/write Parse input to native objects or tree; generate from AST. Grammar-driven; no hardcoded format maps.
Bidirectional Parse to AST, generate back; convert between syntaxes (e.g. JSON to SQL) by swapping grammars.
100+ grammars Query (SQL, Cypher, GraphQL, xwqueryscript, …), data/config, programming, markup, storage. 328+ grammar files (.lark + .json).
xwquery and IDE Parsing and syntax for query languages; Monaco export and codec integration with xwsystem.

Current phase: Alpha. M1–M2 done; xwquery consumption next. Status: REF_22_PROJECT.


Docs and tests


License and links

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

Contributing → CONTRIBUTING.md · Security → SECURITY.md (when present).

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.9.tar.gz (216.0 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.9-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xwsyntax-0.6.0.9.tar.gz
  • Upload date:
  • Size: 216.0 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.9.tar.gz
Algorithm Hash digest
SHA256 b659ec565d84637fbcd15a4d7a3037b1e853fb22d6889ecb5650204ccbb430ec
MD5 8a2cc88f4424885306c9afe5fcc50a86
BLAKE2b-256 243f2e683b9d36499ddbcb6f03c5ed827672655b0c3e43375e1a2852186673d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xwsyntax-0.6.0.9-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 24d087212e3c424d899997fa32edefad9956ff67736baa0d9ebaa0a48156738c
MD5 c7ac2385bb00e17477af512e03933d81
BLAKE2b-256 7315d7543543425f25be6b568ee603c134add4c0ebdd458a60057ee91bfef08c

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