Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into krypto-bytes
Browse files Browse the repository at this point in the history
Scott-Guest committed Oct 23, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 639e67f + 2a99e06 commit 8c862de
Showing 10 changed files with 216 additions and 845 deletions.
56 changes: 39 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -34,41 +34,63 @@ jobs:
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'

- name: Build
run: nix-build -A project.x86_64-linux.kore -A project.x86_64-linux.kore.checks
run: nix build .#kore-exec

cache-cabal:
name: 'Cache Cabal'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-22.04
os: ubuntu-22.04
nix: x86_64-linux
- runner: macos-12
os: macos-12
nix: x86_64-darwin
- runner: MacM1
os: self-macos-12
nix: aarch64-darwin
runs-on: ${{ matrix.runner }}
steps:
- name: Install prerequisites
run: |
sudo apt install --yes z3 libsecp256k1-dev
- name: Check out code
uses: actions/checkout@v3
with:
submodules: recursive

# Do the Following only on Public Runners; Mac Runner is pre-installed with build tools
- name: 'Install Nix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/install-nix-action@v22
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
- name: 'Install Cachix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/cachix-action@v12
with:
name: k-framework
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'

- name: Cache Cabal package database and store
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
key: cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
restore-keys: |
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ env.ghc_version }}
cabal-version: "3.6"
- name: Test
run: GC_DONT_GC=1 nix develop .#cabal --command bash -c "cabal update && cabal test --enable-tests --test-show-details=direct all"

- name: Build
run: cabal v2-build --enable-tests --enable-benchmarks all

cache-stack:
name: 'Cache Stack'
96 changes: 17 additions & 79 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ jobs:

- name: Format
run: |
nix run .#format
nix develop .#fourmolu --command bash -c "./scripts/fourmolu.sh"
- name: Update branch
env:
@@ -109,10 +109,23 @@ jobs:
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'

- name: Build
run: GC_DONT_GC=1 nix-build -A project.${{ matrix.nix }}.kore.components.exes
run: GC_DONT_GC=1 nix build .#kore-exec

- name: Run unit tests
run: GC_DONT_GC=1 nix-build -A project.${{ matrix.nix }}.kore.checks
- name: Cache Cabal package database and store
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
restore-keys: |
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
cabal-nix-${{ runner.os }}-ghc-${{ env.ghc_version }}
- name: Test
run: GC_DONT_GC=1 nix develop .#cabal --command bash -c "cabal update && cabal build all && cabal test --enable-tests --test-show-details=direct all"

nix-integration:
name: 'Nix / Integration'
@@ -146,46 +159,6 @@ jobs:
--override-input haskell-backend . --update-input haskell-backend \
--command bash -c "cd test && make -j2 --output-sync test"
cabal:
name: 'Cabal / Unit Tests'
needs: formatting
runs-on: ubuntu-22.04
steps:
- name: Install prerequisites
run: |
sudo apt install --yes z3 libsecp256k1-dev
- uses: actions/checkout@v3
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive

- name: Cache Cabal package database and store
uses: actions/cache@v3
with:
path: |
~/.cabal/packages
~/.cabal/store
key: cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}-${{ hashFiles('kore-rpc-types/kore-rpc-types.cabal') }}
restore-keys: |
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}-${{ hashFiles('kore/kore.cabal') }}
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}-${{ hashFiles('cabal.project.freeze') }}
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('cabal.project') }}
cabal-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell/actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ env.ghc_version }}
cabal-version: "3.6"

- name: Run unit tests
run: cabal v2-test --enable-tests --test-show-details=direct all

- name: Configure with profiling
run: cabal v2-configure --enable-profiling -f-threaded

stack:
name: 'Stack / Unit Tests'
needs: formatting
@@ -229,41 +202,6 @@ jobs:
- name: Run unit tests
run: stack test --pedantic

stack-haddock:
name: 'Stack / Haddock check'
needs: formatting
runs-on: ubuntu-22.04
steps:
- name: Install prerequisites
run: |
sudo apt install --yes z3 libsecp256k1-dev
- uses: actions/checkout@v3
with:
# Check out pull request HEAD instead of merge commit.
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive

- name: Cache Stack root
uses: actions/cache@v3
with:
path: ~/.stack
key: stack-haddock-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
stack-haddock-2-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-haddock-2-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell/actions/setup@v2
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
stack-version: ${{ env.stack_version }}
enable-stack: true
stack-setup-ghc: true

- name: Build documentation
run: |
stack haddock --fast
hlint:
name: 'HLint'
needs: formatting
2 changes: 1 addition & 1 deletion deps/k_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.144
6.0.151
5 changes: 0 additions & 5 deletions docs/kore-syntax.md
Original file line number Diff line number Diff line change
@@ -181,9 +181,6 @@ A sort is either a _sort variable_ or a _sort constructor_ applied to a list of
<application-pattern> ::=
<symbol-identifier> "{" <sorts> "}" "(" <patterns> ")"
<multi-or> ::=
"\or" "{" <sort> "}" "(" <patterns> ")"
<matching-logic-pattern>
::=
// Connectives
@@ -213,9 +210,7 @@ A sort is either a _sort variable_ or a _sort constructor_ applied to a list of
| "\dv" "{" <sort> "}" "(" <string-literal> ")"
// Syntactic sugar
| "\left-assoc" "{" "}" "(" <application-pattern> ")"
| "\left-assoc" "{" "}" "(" <multi-or> ")"
| "\right-assoc" "{" "}" "(" <application-pattern> ")"
| "\right-assoc" "{" "}" "(" <multi-or> ")"
```

The left-assoc (resp. right-assoc) construct allows a chain of applications of
523 changes: 18 additions & 505 deletions flake.lock

Large diffs are not rendered by default.

342 changes: 139 additions & 203 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,231 +1,167 @@
{
description = "K Kore Language Haskell Backend";
inputs = {
haskell-nix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
z3-src = {
nixpkgs.url = "nixpkgs/nixos-23.05";
stacklock2nix.url = "github:cdepillabout/stacklock2nix";
z3 = {
url = "github:Z3Prover/z3/z3-4.12.1";
flake = false;
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, haskell-nix, z3-src, ... }:
outputs = { self, nixpkgs, stacklock2nix, z3 }:
let
inherit (nixpkgs) lib;
z3-overlay = (final: prev: {
z3 = prev.z3.overrideAttrs (old: {
src = z3-src;
version =

let release = builtins.readFile "${z3-src}/scripts/release.yml";
# read the release version from scripts/release.yml
in builtins.head (builtins.match ".+ReleaseVersion: '([^']+).+" release);
});
});
integration-tests-overlay = (final: prev: {
kore-tests = final.callPackage ./nix/integration-shell.nix {
python = final.python3.withPackages (ps:
with ps;
[
(buildPythonPackage rec {
pname = "jsonrpcclient";
version = "4.0.3";
src = prev.fetchFromGitHub {
owner = "explodinglabs";
repo = pname;
rev = version;
sha256 =
"sha256-xqQwqNFXatGzc4JprZY1OpdPPGgpP5/ucG/qyV/n8hw=";
};
doCheck = false;
format = "pyproject";
buildInputs = [ setuptools ];
})
]);
};
});
perSystem = lib.genAttrs nixpkgs.lib.systems.flakeExposed;
perSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
nixpkgsCleanFor = system: import nixpkgs { inherit system; };
nixpkgsFor = system:
import nixpkgs {
inherit (haskell-nix) config;
inherit system;
overlays = [ haskell-nix.overlays.combined z3-overlay ];
overlays = [ stacklock2nix.overlay self.overlay self.overlays.z3 ];
};

compiler-nix-name = "ghc928";
index-state = "2023-06-26T23:55:21Z";
fourmolu-version = "0.12.0.0";
hlint-version = "3.5";

haskell-backend-src = pkgs:
pkgs.applyPatches {
name = "haskell-backend-src";
# make sure we remove all nix files and flake.lock, since any changes to these triggers re-compilation of kore
src = pkgs.nix-gitignore.gitignoreSourcePure [
"./github"
"/nix"
"*.nix"
"*.nix.sh"
"/.github"
"flake.*"
"/profile"
"/profile-*"
./.gitignore
] ./.;
postPatch = ''
substituteInPlace kore/src/Kore/VersionInfo.hs \
--replace '$(GitRev.gitHash)' '"${self.rev or "dirty"}"'
withZ3 = pkgs: pkg: exe:
pkgs.stdenv.mkDerivation {
name = exe;
phases = [ "installPhase" ];
buildInputs = with pkgs; [ makeWrapper ];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} --prefix PATH : ${pkgs.z3}/bin
'';
};

koreFor = { pkgs, profiling ? false
, profilingDetail ? "toplevel-functions", ghcOptions ? [ ] }:
let
add-z3 = exe: {
build-tools = with pkgs; lib.mkForce [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/${exe} --prefix PATH : ${
with pkgs;
lib.makeBinPath [ z3 ]
}
'';
};
in pkgs.haskell-nix.cabalProject ({
name = "kore";
inherit compiler-nix-name index-state;
src = haskell-backend-src pkgs;

shell = {
withHoogle = true;
tools = {
cabal = "latest";
haskell-language-server = "latest";
fourmolu = {
inherit index-state;
version = fourmolu-version;
};
eventlog2html = "latest";
ghc-prof-flamegraph = "latest";
hlint = {
inherit index-state;
version = hlint-version;
in {
overlay = final: prev: {
haskell-backend = final.stacklock2nix {
stackYaml = ./stack.yaml;
# This should based on the compiler version from the resolver in stack.yaml.
baseHaskellPkgSet = final.haskell.packages.ghc928;
cabal2nixArgsOverrides = args:
args // {
# The Haskell package `"graphviz"` depends on the _system_
# package `graphviz`, and takes the system package `graphviz` as one of its build
# inputs, but it is actually getting passed _itself_ (not the system package
# `graphviz`), which causes the infinite recursion.
"graphviz" = _: { graphviz = final.graphviz; };
};
additionalHaskellPkgSetOverrides = hfinal: hprev:
with final.haskell.lib; {
decision-diagrams = dontCheck hprev.decision-diagrams;
fgl = dontCheck hprev.fgl;
haskeline = dontCheck hprev.haskeline;
json-rpc = dontCheck hprev.json-rpc;
kore = (overrideCabal hprev.kore (drv: {
doCheck = false;
postPatch = ''
${drv.postPatch or ""}
substituteInPlace src/Kore/VersionInfo.hs \
--replace '$(GitRev.gitHash)' '"${self.rev or "dirty"}"'
'';
postInstall = ''
${drv.postInstall or ""}
rm $out/bin/kore-check-functions
rm $out/bin/kore-format
'';
})).override {
# bit pathological, but ghc-compact is already included with the ghc compiler
# and depending on another copy of ghc-compact breaks HLS in the dev shell.
ghc-compact = null;
};
tar = dontCheck hprev.tar;
};
nativeBuildInputs = with nixpkgs.legacyPackages.${pkgs.system};
[ nixpkgs-fmt secp256k1 ]
++ lib.optional (pkgs.system == "aarch64-darwin") pkgs.llvm_12;
};

modules = [{
enableProfiling = profiling;
enableLibraryProfiling = profiling;
packages.kore = {
inherit profilingDetail ghcOptions;

# Wrap all the kore-* executables which use Z3 with
# the path to our pinned Z3 version
components.exes.kore-exec = add-z3 "kore-exec";
components.exes.kore-rpc = add-z3 "kore-rpc";
components.exes.kore-repl = add-z3 "kore-repl";
components.exes.kore-check-functions =
add-z3 "kore-check-functions";
# Additional packages that should be available for development.
additionalDevShellNativeBuildInputs = stacklockHaskellPkgSet:
with final; [
haskell.packages.ghc928.cabal-install
haskellPackages.fourmolu_0_12_0_0
(let
ghc-lib-parser = haskellPackages.ghc-lib-parser_9_4_5_20230430;
ghc-lib-parser-ex =
haskellPackages.ghc-lib-parser-ex_9_4_0_0.override {
inherit ghc-lib-parser;
};
in haskellPackages.hlint_3_5.override {
inherit ghc-lib-parser ghc-lib-parser-ex;
})
(haskell-language-server.override {
supportedGhcVersions = [ "928" ];
})
final.z3
];
all-cabal-hashes = final.fetchurl {
url =
"https://github.com/commercialhaskell/all-cabal-hashes/archive/779bc22f8c7f8e3566edd5a4922750b73a0e5ed5.tar.gz";
sha256 = "sha256-qJ/rrdjCTil5wBlcJQ0w+1NP9F/Cr7X/pAfnnx/ahLc=";
};
};
};

components.tests.kore-test.preCheck = ''
# provide parser test data for json golden tests
mkdir -p ../test/parser
cp -r ${./test/parser}/* ../test/parser
# Add Z3 to PATH for unit tests.
export PATH="$PATH''${PATH:+:}${lib.getBin pkgs.z3}/bin"
'';
};
}];
});
in {
prelude-kore = ./src/main/kore/prelude.kore;

project = perSystem (system: koreFor { pkgs = nixpkgsFor system; });

projectProfilingEventlog = perSystem (system:
koreFor {
pkgs = nixpkgsFor system;
profiling = true;
ghcOptions = [ "-eventlog" ];
});

projectEventlogInfoTable = perSystem (system:
koreFor {
packages = perSystem (system:
let
pkgs = nixpkgsFor system;
ghcOptions =
[ "-finfo-table-map" "-fdistinct-constructor-tables" "-eventlog" ];
kore = with pkgs;
haskell.lib.justStaticExecutables haskell-backend.pkgSet.kore;
in {
kore-exec = withZ3 pkgs kore "kore-exec";
kore-match-disjunction = withZ3 pkgs kore "kore-match-disjunction";
kore-parser = withZ3 pkgs kore "kore-parser";
kore-repl = withZ3 pkgs kore "kore-repl";
kore-rpc = withZ3 pkgs kore "kore-rpc";
});

flake = perSystem (system: self.project.${system}.flake { });
devShells = perSystem (system: {
# Separate fourmolu and cabal shells just for CI
fourmolu = with nixpkgsCleanFor system;
mkShell {
nativeBuildInputs = [
(haskell.lib.justStaticExecutables
haskellPackages.fourmolu_0_12_0_0)
];
};
cabal = let pkgs = nixpkgsFor system;
in pkgs.haskell-backend.pkgSet.shellFor {
packages = pkgs.haskell-backend.localPkgsSelector;
nativeBuildInputs =
[ pkgs.haskell.packages.ghc928.cabal-install pkgs.z3 ];
};
});

packages = perSystem (system:
self.flake.${system}.packages // {
kore-exec =
self.project.${system}.hsPkgs.kore.components.exes.kore-exec;
kore-exec-prof =
self.projectProfilingEventlog.${system}.hsPkgs.kore.components.exes.kore-exec;
kore-exec-infotable =
self.projectEventlogInfoTable.${system}.hsPkgs.kore.components.exes.kore-exec;
devShell =
perSystem (system: (nixpkgsFor system).haskell-backend.devShell);

overlays = {
z3 = (final: prev: {
z3 = prev.z3.overrideAttrs (_: {
src = z3;
version = let
release = builtins.readFile "${z3}/scripts/release.yml";
# Read the release version from scripts/release.yml
in builtins.head
(builtins.match ".+ReleaseVersion: '([^']+).+" release);
});
});

apps = perSystem (system:
self.flake.${system}.apps // (let
pkgs = nixpkgsFor system;
profiling-script = pkgs.callPackage ./nix/run-profiling.nix {
inherit (pkgs.haskellPackages) hp2pretty eventlog2html;
kore-exec =
self.project.${system}.hsPkgs.kore.components.exes.kore-exec;
kore-exec-prof =
self.projectProfilingEventlog.${system}.hsPkgs.kore.components.exes.kore-exec;
kore-exec-infotable =
self.projectEventlogInfoTable.${system}.hsPkgs.kore.components.exes.kore-exec;
};
fourmolu = (pkgs.haskell-nix.hackage-package {
name = "fourmolu";
version = fourmolu-version;
inherit compiler-nix-name index-state;
}).components.exes.fourmolu;
scripts = pkgs.symlinkJoin {
name = "fourmolu-format";
paths = [ ./scripts ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/fourmolu.sh \
--set PATH ${
with pkgs;
lib.makeBinPath [ fourmolu git gnugrep findutils ]
}
'';
integration-tests = (final: prev: {
kore-tests = final.callPackage ./nix/integration-shell.nix {
python = final.python3.withPackages (ps:
with ps;
[
(buildPythonPackage rec {
pname = "jsonrpcclient";
version = "4.0.3";
src = prev.fetchFromGitHub {
owner = "explodinglabs";
repo = pname;
rev = version;
sha256 =
"sha256-xqQwqNFXatGzc4JprZY1OpdPPGgpP5/ucG/qyV/n8hw=";
};
doCheck = false;
format = "pyproject";
buildInputs = [ setuptools ];
})
]);
};
in {
profile = {
type = "app";
program = "${profiling-script}/bin/run-profiling";
};
format = {
type = "app";
program = "${scripts}/fourmolu.sh";
};
}));

devShells =
perSystem (system: { default = self.flake.${system}.devShell; });

overlay = nixpkgs.lib.composeManyExtensions [
haskell-nix.overlay
(final: prev: {
haskell-backend-cabalProject = koreFor { pkgs = final; };
})
z3-overlay
integration-tests-overlay
];
overlays.z3 = z3-overlay;
overlays.integration-tests = integration-tests-overlay;
});
};
};
}
10 changes: 1 addition & 9 deletions kore/app/share/GlobalMain.hs
Original file line number Diff line number Diff line change
@@ -70,9 +70,6 @@ import Data.Text (
pack,
)
import Data.Text.IO qualified as Text
import Data.Version (
showVersion,
)
import GHC.Compact (getCompact)
import GHC.Generics qualified as GHC
import GHC.Stack (
@@ -181,9 +178,6 @@ import Options.SMT (
KoreSolverOptions (..),
Solver (..),
)
import Paths_kore qualified as MetaData (
version,
)
import Prelude.Kore
import Pretty qualified as KorePretty
import SMT (
@@ -367,14 +361,12 @@ mainVersion :: IO ()
mainVersion =
mapM_
putStrLn
[ "Kore version " ++ packageVersion
, "Git:"
[ "Git:"
, " revision:\t" ++ gitHash ++ if gitDirty then " (dirty)" else ""
, " branch:\t" ++ fromMaybe "<unknown>" gitBranch
, " last commit:\t" ++ gitCommitDate
]
where
packageVersion = showVersion MetaData.version
VersionInfo{gitHash, gitDirty, gitBranch, gitCommitDate} = $versionInfo

--------------------
1 change: 0 additions & 1 deletion kore/kore.cabal
Original file line number Diff line number Diff line change
@@ -561,7 +561,6 @@ library
Options.SMT
Pair
Partial
Paths_kore
Prelude.Kore
Pretty
Prof
24 changes: 0 additions & 24 deletions kore/src/Kore/Parser/Parser.y
Original file line number Diff line number Diff line change
@@ -227,24 +227,8 @@ StringLiteral :: {StringLiteral}
ApplicationPattern :: {ParsedPattern}
: leftAssoc '{' '}' '(' ident SortsBrace NePatterns ')'
{ mkAssoc True $5 $6 $7 }
| leftAssoc '{' '}' '(' and SortsBrace NePatterns ')'
{ mkAssoc True $5 $6 $7 }
| leftAssoc '{' '}' '(' or SortsBrace NePatterns ')'
{ mkAssoc True $5 $6 $7 }
| leftAssoc '{' '}' '(' implies SortsBrace NePatterns ')'
{ mkAssoc True $5 $6 $7 }
| leftAssoc '{' '}' '(' iff SortsBrace NePatterns ')'
{ mkAssoc True $5 $6 $7 }
| rightAssoc '{' '}' '(' ident SortsBrace NePatterns ')'
{ mkAssoc False $5 $6 $7 }
| rightAssoc '{' '}' '(' and SortsBrace NePatterns ')'
{ mkAssoc False $5 $6 $7 }
| rightAssoc '{' '}' '(' or SortsBrace NePatterns ')'
{ mkAssoc False $5 $6 $7 }
| rightAssoc '{' '}' '(' implies SortsBrace NePatterns ')'
{ mkAssoc False $5 $6 $7 }
| rightAssoc '{' '}' '(' iff SortsBrace NePatterns ')'
{ mkAssoc False $5 $6 $7 }
| top '{' Sort '}' '(' ')'
{ embedParsedPattern $ TopF Top{topSort = $3} }
| bottom '{' Sort '}' '(' ')'
@@ -442,14 +426,6 @@ the result. Namely, \\and, \\or, \\implies, and \\iff. Designed to be passed to
foldl1' or foldr1.
-}
mkApply :: Token -> [Sort] -> ParsedPattern -> ParsedPattern -> ParsedPattern
mkApply tok@(Token _ TokenAnd) [andSort] andFirst andSecond =
embedParsedPattern $ AndF And{andSort, andChildren=[andFirst, andSecond]}
mkApply tok@(Token _ TokenOr) [orSort] orFirst orSecond =
embedParsedPattern $ OrF Or{orSort, orChildren=[orFirst, orSecond]}
mkApply tok@(Token _ TokenImplies) [impliesSort] impliesFirst impliesSecond =
embedParsedPattern $ ImpliesF Implies{impliesSort, impliesFirst, impliesSecond}
mkApply tok@(Token _ TokenIff) [iffSort] iffFirst iffSecond =
embedParsedPattern $ IffF Iff{iffSort, iffFirst, iffSecond}
mkApply tok@(Token _ (TokenIdent _)) sorts first second =
embedParsedPattern $ ApplicationF Application
{ applicationSymbolOrAlias = SymbolOrAlias { symbolOrAliasConstructor = mkId tok
2 changes: 1 addition & 1 deletion test/issue-3508/disjunction.kore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
\left-assoc{}(\or{SortGeneratedTopCell{}}(Lbl'-LT-'generatedTop'-GT-'{}(Lbl'-LT-'T'-GT-'{}(Lbl'-LT-'threads'-GT-'{}(\left-assoc{}(Lbl'Unds'ThreadCellMap'Unds'{}(LblThreadCellMapItem{}(Lbl'-LT-'id'-GT-'{}(\dv{SortInt{}}("0")),Lbl'-LT-'thread'-GT-'{}(Lbl'-LT-'id'-GT-'{}(\dv{SortInt{}}("0")),Lbl'-LT-'k'-GT-'{}(dotk{}()),Lbl'-LT-'env'-GT-'{}(Lbl'Stop'Map{}())))))),Lbl'-LT-'store'-GT-'{}(Lbl'Stop'Map{}()),Lbl'-LT-'input'-GT-'{}(\left-assoc{}(Lbl'Unds'List'Unds'{}(LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'buffer'LParUndsRParUnds'K-IO'Unds'Stream'Unds'K{}(kseq{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("")),dotk{}())))),LblListItem{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("off"))),LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'istream'LParUndsRParUnds'K-IO'Unds'Stream'Unds'Int{}(\dv{SortInt{}}("0"))))))),Lbl'-LT-'output'-GT-'{}(\left-assoc{}(Lbl'Unds'List'Unds'{}(LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'ostream'LParUndsRParUnds'K-IO'Unds'Stream'Unds'Int{}(\dv{SortInt{}}("1")))),LblListItem{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("off"))),LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'buffer'LParUndsRParUnds'K-IO'Unds'Stream'Unds'K{}(kseq{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("60")),dotk{}())))))))),Lbl'-LT-'generatedCounter'-GT-'{}(\dv{SortInt{}}("0")))))
\or{SortGeneratedTopCell{}}(Lbl'-LT-'generatedTop'-GT-'{}(Lbl'-LT-'T'-GT-'{}(Lbl'-LT-'threads'-GT-'{}(\left-assoc{}(Lbl'Unds'ThreadCellMap'Unds'{}(LblThreadCellMapItem{}(Lbl'-LT-'id'-GT-'{}(\dv{SortInt{}}("0")),Lbl'-LT-'thread'-GT-'{}(Lbl'-LT-'id'-GT-'{}(\dv{SortInt{}}("0")),Lbl'-LT-'k'-GT-'{}(dotk{}()),Lbl'-LT-'env'-GT-'{}(Lbl'Stop'Map{}())))))),Lbl'-LT-'store'-GT-'{}(Lbl'Stop'Map{}()),Lbl'-LT-'input'-GT-'{}(\left-assoc{}(Lbl'Unds'List'Unds'{}(LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'buffer'LParUndsRParUnds'K-IO'Unds'Stream'Unds'K{}(kseq{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("")),dotk{}())))),LblListItem{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("off"))),LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'istream'LParUndsRParUnds'K-IO'Unds'Stream'Unds'Int{}(\dv{SortInt{}}("0"))))))),Lbl'-LT-'output'-GT-'{}(\left-assoc{}(Lbl'Unds'List'Unds'{}(LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'ostream'LParUndsRParUnds'K-IO'Unds'Stream'Unds'Int{}(\dv{SortInt{}}("1")))),LblListItem{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("off"))),LblListItem{}(inj{SortStream{}, SortKItem{}}(Lbl'Hash'buffer'LParUndsRParUnds'K-IO'Unds'Stream'Unds'K{}(kseq{}(inj{SortString{}, SortKItem{}}(\dv{SortString{}}("60")),dotk{}())))))))),Lbl'-LT-'generatedCounter'-GT-'{}(\dv{SortInt{}}("0"))))

0 comments on commit 8c862de

Please sign in to comment.