Skip to main content

Executable Shlaer-Mellor Class Model Parser

Project description

Executable Class Model Parser

Parses an *.xcm file (Executable Class Model) to yield an abstract syntax tree using python named tuples

Why you need this

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

Installation

Create or use a python 3.11+ environment. Then

% pip install xcm-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 xcm-parser.parser import ClassModelParser

You can then either specify a path or a text variable using the appropriate method:

result = ClassModelParser.parse_text(model_text, debug=False)

OR

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

Check the code in parser.py to verify I haven't changed these parameters on you wihtout updating the readme.

In either case, result will be a list of parsed scrall 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...

% xcm elevator.xcm

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

You can also specify a debug option like this:

% xcm elevator.xcm -D

This will create a scrall-diagnostics folder in your current working directory and deposite a coupel of PDFs defining the parse of both the scrall grammar: class_model_tree.pdf and your supplied text: class_model.pdf.

You should also see a file named xcm-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

xcm-parser-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

xcm_parser-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file xcm-parser-0.1.0.tar.gz.

File metadata

  • Download URL: xcm-parser-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for xcm-parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3595018c79a9a8a8300a6236a7b213df4a8ba5d3545af44c1d8d88d15fc35a36
MD5 2e65058a020328679e6e8ae9bcb2c23f
BLAKE2b-256 c6d9f1cdf5ae7d36f781713c9f3aca3e12c690e348064625bb6a997d8449902b

See more details on using hashes here.

File details

Details for the file xcm_parser-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xcm_parser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for xcm_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 104ef6fae8092836d6b6f851c82e944091a8a084f06bbf46ccf05aa2c22a1955
MD5 0fc04a66999f9930ef3ccf5a26fd7b77
BLAKE2b-256 57f325a4f3ba7850cafa615c7e699f5d10bcefb6a3d51fcec574a9da00dd95dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page