PyMeta3 is a Python 3 compatible fork of PyMeta, an implementation of OMeta, an object-oriented pattern-matching language. It provides a compact syntax based on Parsing Expression Grammars (PEGs) for common lexing, parsing, and tree-transforming activities in a way that's easy to reason about for Python programmers. The current version is 0.5.1, with the last update released in February 2015, suggesting a low release cadence.
pip install PyMeta3Verified import paths — ran on the pinned version, not inferred.
This example demonstrates how to define a simple grammar using PyMeta3, create a grammar object, and apply a rule to an input string. It defines rules 'ones' and 'twos' to match sequences of '1's and '2's respectively, and a 'stuff' rule that matches one or more occurrences of 'ones' or 'twos'. The `apply` method attempts to parse the input according to the specified rule and returns the result and any error encountered.
Always use `pip install PyMeta3` in a Python 3 environment. Do not confuse it with the older `pymeta` package.
Double-check the package name and description on PyPI before installation. Use `pip install PyMeta3` specifically.
While still functional for its intended purpose, users should be aware of the limited ongoing support. Consider the implications for long-term projects or environments requiring frequent updates.
Ensure `pymeta3` is installed with `pip install PyMeta3` and then import from `pymeta.grammar` as in `from pymeta.grammar import OMeta`.
Install the `pymeta3` package using `pip install PyMeta3`. If it's already installed, verify your Python environment and ensure `pymeta3` is accessible by the interpreter being used.
To resolve this, you can downgrade your NumPy version to one that supports `numpy.bool` (e.g., `pip install numpy<1.24`) or modify the code (if possible) to replace `np.bool` with the built-in `bool` type.