Skip to main content

Executable Shlaer-Mellor Class Method Parser

Project description

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

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

mtd_parser-0.2.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mtd_parser-0.2.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mtd_parser-0.2.1.tar.gz.

File metadata

  • Download URL: mtd_parser-0.2.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for mtd_parser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8ec1db44d213b10d7cbc42c2ec527711209ff2ae9bd1f593b3cd9540504aa8b9
MD5 0327546fb3fc55d0b4133d3856d834ea
BLAKE2b-256 b146c05cf4fa4d769366a67eecef6e690359ca061046a315c23dd37b5483fa08

See more details on using hashes here.

File details

Details for the file mtd_parser-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: mtd_parser-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for mtd_parser-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d58bbd1ea41ac0c94fa675c3b4fde6c517ebf91d40cc29a6bf0a435181cb73ab
MD5 82e2bb24b63cbfc85c6aae639ffc3d25
BLAKE2b-256 44000212bdc236ecfee940e218d9a0d48d87c5a253eb97b605f125a40951cd2e

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