textX is a meta-language for building Domain-Specific Languages (DSLs) in Python, inspired by Xtext. It allows you to define a grammar using a simple, intuitive syntax and then generates a parser and an object model for your DSL. The current version is 4.3.0, and it has a steady release cadence, primarily focusing on maintenance and Python version compatibility.
pip install textxVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a simple grammar as a string, create a metamodel from it, and then parse an input string to build a model. It also shows basic error handling for invalid input.
Upgrade your Python environment to 3.8 or newer before upgrading textX to version 4.0.0 or later.
Update your grammar files to use `:` as the object rule reference separator (e.g., `rule_name:obj_ref` instead of `rule_name|obj_ref`).
If you have custom tooling or integrations that intercept `click.echo` output, you may need to update them to capture standard Python `logging` output instead.
Test your existing grammars and input files thoroughly after upgrading to 4.0.0+ if they use the built-in `INT` rule and have complex integer parsing scenarios. Adjust your grammar or input as needed.
Carefully review your input string against your grammar definition. Use the textX CLI with the `--debug` flag (`textx generate --debug my_grammar.tx my_input.txt`) or `textx_tools.debugger` to visualize the parsing process and pinpoint the exact location of the syntax error.
Ensure that all referenced objects are correctly defined and named within your grammar. Verify that the input text contains the definitions of all objects before they are referenced. Check for typos in object names or reference rules.
Inspect your grammar file for any misspelled rule names or rules that are declared but never defined. All rules mentioned in other rules or as the starting rule of the metamodel must have a corresponding definition.
No dependency data recorded yet.