Skip to main content

Executable UML Class Method Parser

Parses an *.mtd file (method) to yield an abstract syntax tree using python named tuples

Why you need this

You need to process an *.mtd file in preparation for populating a database or some other purpose

Installation

Create or use a python 3.11+ environment. Then

% pip install mtd-parser

At this point you can invoke the parser via the command line or from your python script.

From your python script

You need this import statement at a minimum:

from mtd-parser.parser import MethodParser

You then specify a path as shown:

result = MethodParser.parse_file(file_input=path_to_file, debug=False)

Then result will be a list of parsed method statements. You may find the header of the visitor.py file helpful in interpreting these results.

From the command line

This is not the intended usage scenario, but may be helpful for testing or exploration. Since the parser may generate some diagnostic info you may want to create a fresh working directory and cd into it first. From there...

% mtd ping.mtd

The .mtd extension is not necessary, but the file must contain mtd text. See this repository's wiki for more about the xsm language. The grammar is defined in the method.peg file. (if the link breaks after I do some update to the code, just browse through the code looking for the method.peg file, and let me know so I can fix it)

You can also specify a debug option like this:

% mtd ping.mtd -D

This will create a diagnostics folder in your current working directory and deposit a couple of PDFs defining the parse of both the state model grammar: method_tree.pdf and your supplied text: method.pdf.

You should also see a file named mtd-parser.log in a diagnostics directory within your working directory

Metadata

Release files for mtd-parser 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mtd-parser 0.2.2
File Size Uploaded Provenance Actions
mtd_parser-0.2.2.tar.gz 9.2 kB Without provenance Details for mtd_parser-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mtd-parser 0.2.2
File Interpreter ABI Platform Actions
mtd_parser-0.2.2-py3-none-any.whl Python 3 none any Details for mtd_parser-0.2.2-py3-none-any.whl

Total release size: 18.6 kB

Release files / mtd_parser-0.2.2.tar.gz

Download URL mtd_parser-0.2.2.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c414bb2bdcfa6ac3e483cee0fd4ceaad6c22759823001942e8eb850debd6f6f2
BLAKE2b-256 checksum
How to use checksums
6fa7bdd6faaea432c014e04fe25579e5bbcea21f678af3252cd4ab96963318d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / mtd_parser-0.2.2-py3-none-any.whl

Download URL mtd_parser-0.2.2-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
348dd044e1f92d0cd5fada3adfc2e7919dd1d77f2bc704956e9a15409b198062
BLAKE2b-256 checksum
How to use checksums
618114ca774667e58e5617d35974b48a10fc204ab382452acdc2992963be4268
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Security for mtd-parser 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page