Skip to main content

Flatland Model Layout Sheet Parser

Project description

Model Layout Sheet Parser

Parses an *.mls file (Model Layout Sheet) to yield an abstract syntax tree using python named tuples

Why you need this

You need to process an *.mls file to layout a model diagram

Installation

Create or use a python 3.11+ environment. Then

% pip install mls-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 mls_parser.parser import LayoutParser

You can then specify a path as shown:

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

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

% mls elevator.mls

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

You can also specify a debug option like this:

% mls elevator.mls -D

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

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

mls_parser-0.0.3.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

mls_parser-0.0.3-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file mls_parser-0.0.3.tar.gz.

File metadata

  • Download URL: mls_parser-0.0.3.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for mls_parser-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3dbc9a60815f8e1c96914df4b8e611a83a05bffb71ceca60225bde129e15951f
MD5 6d628c6428ae0f628de2466fc464da85
BLAKE2b-256 cec31e750802d3fa74a87f38b4e653929f90a732b59c5385d0708bbbff0ccd73

See more details on using hashes here.

File details

Details for the file mls_parser-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mls_parser-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for mls_parser-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b672d40dae1b904130139b2a376e1f8597d26782b0c919a17e5980b67c9afcd2
MD5 d25b8140005992a49bbe8eaa838fca8c
BLAKE2b-256 6b8a2e485b4c4a7464659b3936b02b9a8f2cad79e47c10549d8f9c731126268d

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