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.11.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.11-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xwsyntax-0.6.0.11.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.11.tar.gz
Algorithm Hash digest
SHA256 03abf190a3eb111b667588bb5f8927b1dcc5f7133633124d2c0c692ec2307d33
MD5 4f8619f24dc41d27a78363739ca04f11
BLAKE2b-256 95f20e1d83519db01d42fbf954d8d6c442ba92f44151ee785c1a67fdd58195c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xwsyntax-0.6.0.11-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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 6a00fc9a87de050c977d5b847fd27ac3f22ef66faa57948c6fe8e57a2be744aa
MD5 7779806a9ccbd3546207c1965f7cfed2
BLAKE2b-256 b07286929ec5a42c4f15826e739658d40b7bee25866bbdcfe750fd59a90ccc70

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