Skip to content

Introduce support for Lustre boolean expressions. Refs #267.#268

Merged
ivanperez-keera merged 6 commits intonasa:developfrom
ivanperez-keera:develop-rename-lustre
Mar 22, 2025
Merged

Introduce support for Lustre boolean expressions. Refs #267.#268
ivanperez-keera merged 6 commits intonasa:developfrom
ivanperez-keera:develop-rename-lustre

Conversation

@ivanperez-keera
Copy link
Copy Markdown
Member

This commit renames an existing package that already supports some of the Lustre syntax to use the name lustre in the package name, and adjusts imports, filenames, and other references across the codebase to use the name Lustre or lustre, as applicable, instead, as prescribed in the solution proposed for #267.

…. Refs nasa#267.

There is a need for Ogma to be able to parse Lustre expressions.
Allowing for Lustre would increase the versatility of Ogma, and would
allow engineers to use languages they may be familiar with and leverage
Ogma's capabilities.

This commit renames the ogma-language-cocospec, which uses the same
syntax (with specific temporal logic operators), to
ogma-language-lustre, replacing all references and filenames
accordingly.
…ge. Refs nasa#267.

There is a need for Ogma to be able to parse Lustre expressions.
Allowing for Lustre would increase the versatility of Ogma, and would
allow engineers to use languages they may be familiar with and leverage
Ogma's capabilities.

A prior commit has introduced a package ogma-language-lustre that
substitutes an existing package in the codebase.

This commit replaces all occurrences of the package by the old name, as
well as all pertinent filenames and expression formats, to use the name
Lustre or lustre instead, as applicable.
…e. Refs nasa#267.

There is a need for Ogma to be able to parse Lustre expressions.
Allowing for Lustre would increase the versatility of Ogma, and would
allow engineers to use languages they may be familiar with and leverage
Ogma's capabilities.

A prior commit has introduced a package ogma-language-lustre that
substitutes an existing package in the codebase.

This commit replaces all occurrences of the package by the old name, as
well as all pertinent filenames and expression formats, to use the name
Lustre or lustre instead, as applicable.
@ivanperez-keera
Copy link
Copy Markdown
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following dockerfile uses the standalone backend and the new property language lustre to produce a monitor from an input file listing properties, after which it prints the message "Success":
      --- Dockerfile-verify-267
      FROM ubuntu:focal
      
      ENV DEBIAN_FRONTEND=noninteractive
      RUN apt-get update
      
      RUN apt-get install --yes \
            curl g++ gcc git libgmp3-dev libz-dev make pkg-config libbz2-dev libexpat-dev
      
      RUN mkdir -p $HOME/.local/bin
      ENV PATH=$PATH:/root/.local/bin/
      
      RUN curl https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -o $HOME/.local/bin/ghcup
      RUN chmod a+x $HOME/.local/bin/ghcup
      
      ENV PATH=$PATH:/root/.ghcup/bin/
      RUN ghcup install ghc 9.10
      RUN ghcup install cabal 3.12
      RUN ghcup set ghc 9.10.1
      RUN cabal update
      
      ADD document.json   /tmp/
      ADD json-format.cfg /tmp/
      
      SHELL ["/bin/bash", "-c"]
      CMD git clone $REPO \
          && cd $NAME \
          && git checkout $COMMIT \
          && cabal install ogma-cli:ogma \
          && ogma standalone --file-name /tmp/document.json -f /tmp/json-format.cfg -p lustre \
          && echo "Success"
      
      --- document.json
      {
        "Example": {
          "internal_variables": [],
          "external_variables": [
            {"name":"input", "type":"Float", "meaning": "Input from the system"}
          ],
          "properties": [
            {
              "id":      "MyProperty",
              "formula": "input <> 30.0",
              "text":    "Input is never 30"
            }
          ]
        }
      }
      
      --- json-format.cfg
      JSONFormat
         { specInternalVars    = Just "..internal_variables[*]"
         , specInternalVarId   = ".name"
         , specInternalVarExpr = ".meaning"
         , specInternalVarType = Just ".type"
         , specExternalVars    = Just "..external_variables[*]"
         , specExternalVarId   = ".name"
         , specExternalVarType = Just ".type"
         , specRequirements    = "..properties[*]"
         , specRequirementId   = ".id"
         , specRequirementDesc = Just ".text"
         , specRequirementExpr = ".formula"
         , specRequirementResultType = Nothing
         , specRequirementResultExpr = Nothing
         }
      
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "COMMIT=5b05f18240d2dcd47715cc486788e64d898a4113" -e "NAME=ogma" ogma-verify-267
      
  • Implementation is documented. Details:
    The new library includes documentation for the Cabal package, all grammars and Haskell files. Other changes do not require adjusting or adding documentation.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    Change does not affect existing examples.
  • Author is internal or has provided signed CLA.
  • Required version bumps are evaluated. Details:
    Bump required; this PR removes an existing library and changes several public types in other libraries, thus not being backwards compatible.

@ivanperez-keera ivanperez-keera merged commit bfb87bc into nasa:develop Mar 22, 2025
2 checks passed
@ivanperez-keera ivanperez-keera deleted the develop-rename-lustre branch March 22, 2025 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant