Ztrategic: Libraries and Tools For Software Language Specification, Transformation, and Testing - Artifact

Read full text
Authors: Emanuel Rodrigues, José Nuno Macedo, João Saraiva
Cited by: 1

Abstract

Ztrategic: Libraries and Tools For Software Language Specification, Transformation, and TestingAuthorsEmanuel Rodrigues; Universidade do Minho; jose.e.rodrigues@inesctec.ptJosé Nuno Macedo; Universidade do Minho; jose.n.macedo@inesctec.ptJoão Saraiva; Universidade do Minho; saraiva@di.uminho.ptAssociated Paper InformationTitle: Ztrategic: Libraries and Tools For Software Language Specification, Transformation, and TestingAbstract: This tool paper presents the Ztrategic framework, which integrates strategic term rewriting and attributes grammars through a unifying navigation abstraction based on functional zippers. The resulting zipper-based embedding is both concise and expressive, integrating the strengths of both formalisms. Together, these mechanisms serve as foundational building blocks for Ztrategic for supporting property-based testing in language engineering. The Ztrategic framework offers libraries and supporting tools that embed strategic term rewriting, attribute grammars, and property-based testing in two host languages: Haskell and Python.DocumentationThe provided .zip file is a subset of various online repositories available at:https://github.com/SLE-Laboratory/Ztrategichttps://github.com/SLE-Laboratory/Ztrategic-exampleshttps://github.com/SLE-Laboratory/pyZtrategicStructureZtrategic/Contains the Haskell version of the strategic programming libraryZtrategic-examples/Contains the examples used with the Haskell version of ZtrategicpyZtrategic/Contains Python version of the strategic programming library, as well as its examplesZtrategic-examples/Examples/Contains the base data types, attribute grammars and properties for the examples, in particular, RepMin and Let. Notably:Ztrategic-examples/Examples/RepMin/RepMinProperty.hs - contains properties defined for the RepMin language.Ztrategic-examples/Examples/Let/LetProperty.hs - contains properties defined for the Let language.Ztrategic-examples/AGMaker/Contains the Template Haskell code to automatically derive Attribute Grammar boilerplate codeZtrategic-examples/Scopes/Contains all code needed for the Haskell example. Notably:Scopes/HaskellProperty.hs - contains properties defined for the Haskell language.stack.yamlStack configuration filepackage.yamlStack configuration filepyZtrategic/pyztrategic/Contains the zipper and strategic programming languagespyZtrategic/examples/Contains the base data types, attribute grammars and properties for the RepMin and Let examples. Notably:pyZtrategic/examples/repmin/test_repmin.py - contains properties defined for the RepMin language.pyZtrategic/examples/let/test_let.py - contains properties defined for the Let language.pyproject.tomlPoetry configuration filepoetry.lockPoetry configuration fileArtifact Evaluation EnvironmentAll artifacts are Haskell and Python code expected to run in any system. This project requires several Haskell and Python dependencies. For this, a Stack configuration was set up so that the dependencies are downloaded automatically for the Haskell code. A Poetry configuration was set up so that the Python dependencies are downloaded automatically.RequirementsStack > 2.0.0 - a project manager for Haskell. Note: Package managers such as apt might only contain old versions of Stack - the preferred way to install Stack is through Ghcup: https://www.haskell.org/ghcup/Python >= 3.12Poetry - a tool for dependency management and packaging in Python. Installed using pip.Kick-the-TiresTo use these artifacts, it is only needed toInstall Stack and use stack ghci to open the standard Haskell interpreter. Stack will read the provided configuration files and automatically download and prepare all required dependencies.Install Poetry and use it to run the Python programs. Poetry will read the provided configuration files and automatically download and prepare all required dependencies.Steps to Perform a Quick Test - HaskellInstall Ghcupinstructions available here: https://www.haskell.org/ghcup/Use ghcup to install stack - ghcup install stack 3.3.1Most recent versions should work fine, but 3.3.1 is verified to workSet active stack version - ghcup set stack 3.3.1Run the following command: stack ghci Examples/RepMin/RepMinProperty.hsThis will open RepMinProperty module with the Haskell interpreter. Stack might take a long time downloading and preparing dependencies for the first run.Inside the interpreter, run the following command: runTestsThis should run all RepMin properties automatically. The user should see several occurrences of names of properties (starting with prop_) followed by +++ OK, passed 100 tests..GHCi can be closed with the :quit command.Troubleshooting:If Stack fails to build the project, ensure that you have a recent version of Stack installed.The files produced by Stack are placed inside a .stack-work folder. If the setup is not working properly, delete this folder and try again.Steps to Perform a Quick Test - PythonInstall PoetryRun pip install python3-poetryUse poetry to install the dependencies - poetry installRun the following command poetry run pytest examples/repmin/test_repmin.pyThis should run all RepMin properties automatically.Full EvaluationThis artifact focuses on the Ztrategic libraries in both Haskell and Python and their examples. The steps to execute RepMin are provided above; the steps for Let are similar, but there are some caveats:Let - HaskellRun the following command: stack ghci Examples/Let/LetProperty.hsThis will open LetProperty module with the Haskell interpreter. Stack might take a long time downloading and preparing dependencies for the first run.Inside the interpreter, run the following command: runTestsThis should run all Let properties automatically. The user should see several occurrences of names of properties (starting with prop_), mostly followed by +++ OK, passed 100 tests.. Some properties might fail due to taking too long to execute. We welcome expert Haskell developers to study why the properties fail, what does that mean in their context, and how the code/properties could be improved accordingly.These properties are using a standard Let generator. To swap to the circular Let generator, open file Examples/Let/LetGenerator.hs, comment line 13 and uncomment line 14. If needed, reload the file in GHCi with :reload. Then, run the properties again with runTests.Let - PythonRun the following command poetry run pytest examples/let/test_let.pyThis should run all Let properties automatically. One property might fail due to the way we are generating our let examples.

Publication details

Journal / source
Figshare
Publication date
11 May 2026