From 4b82d4af0c25fb94b0f4f109cf824eec6d71a1d7 Mon Sep 17 00:00:00 2001 From: Evgeny Blokhin Date: Mon, 15 Apr 2024 14:25:55 +0200 Subject: [PATCH] Polish readme and remove lark's remnants --- Makefile | 10 ---------- README.md | 24 ++++++++++++++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index 34ca5f7..0000000 --- a/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -.DEFAULT_GOAL := parser -.PHONY: parser - -pytopas/lark_standalone.py: pytopas/grammar.lark - PYTHONHASHSEED=0 python -m lark.tools.standalone -s topas $< > $@ - -parser: pytopas/lark_standalone.py - -dist: pytopas/* pyproject.toml - flit build diff --git a/README.md b/README.md index 5149c9e..244a34c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,24 @@ # pytopas -This is the parser for Bruker's TOPAS macro language. We have compared two canonical parsing approaches for Python: `lark` vs. `pyparsing`. +This is an early version of Bruker's TOPAS macro language parser, used by [commercial](https://www.bruker.com/de/products-and-solutions/diffractometers-and-x-ray-microscopes/x-ray-diffractometers/diffrac-suite-software.html) and [academic](http://www.topas-academic.net) TOPAS code. We have compared two canonical parsing approaches for Python, `lark` vs. `pyparsing`, and ended up with `pyparsing` being more convenient for debugging. + + +## Installation + +`pip install .` + +Install package with optional dependencies with `pip install -e .[lint,test,release]` + ## Usage -Parse TOPAS input and convert it to JSON: +Parse a TOPAS macro language node with: + +```sh +echo "xdd { 42 }" | topas2json - | json2topas - +``` + +More specifically, parse TOPAS input and convert it to JSON with: ```python import json @@ -35,7 +49,8 @@ print(src) ``` -## Command line utilities + +## CLI After installing the package, two command line utilities will be available. @@ -65,9 +80,6 @@ options: ``` -## Development - -Install package with optional dependencies: `pip install -e .[lint,test,release]` ## License