Skip to main content

Executable Shlaer-Mellor State Model Parser

Project description

Executable State Model Parser

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

Why you need this

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

Installation

Create or use a python 3.11+ environment. Then

% pip install xsm-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 xsm-parser.parser import StateModelParser

You then specify a path as shown:

result = StateModelParser.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...

% xsm cabin.xsm

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

You can also specify a debug option like this:

% xsm cabin.xsm -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: state_model_tree.pdf and your supplied text: state_model.pdf.

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

xsm_parser-0.1.4.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

xsm_parser-0.1.4-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file xsm_parser-0.1.4.tar.gz.

File metadata

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

File hashes

Hashes for xsm_parser-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e7bbc9522114c6860fec2fbe855ffdc75fc9d2cd4c09c7efc2cbedf96c533df3
MD5 e051bc61089ea7d3efb0f790616e5fc3
BLAKE2b-256 443f40da83d0aa33bdc99595d5bf662fd850f24e58865c0acb2a0abe278c5938

See more details on using hashes here.

File details

Details for the file xsm_parser-0.1.4-py3-none-any.whl.

File metadata

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

File hashes

Hashes for xsm_parser-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bd0b5c4f202aefc29fc15f664c4adc3629047122b57523a3471fc52fd8da1d51
MD5 818f6e3d468e040460b353a50ac0ff6c
BLAKE2b-256 a0572cedb5913bd2f2f0b44401725da7e3c9bb135de470775c4e673a0911c711

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