Skip to content

Commit

Permalink
Merge branch 'develop' into refactor-assoc
Browse files Browse the repository at this point in the history
  • Loading branch information
rv-jenkins authored Jul 2, 2024
2 parents fe02e64 + 25bbf54 commit 2ed6d2b
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 75 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,16 @@ jobs:
packages-dir: pyk/dist
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Wait for PyPi to publish Pyk
run: |
while true; do
VERSION=$(cat package/version)
if curl --fail --silent --location --head "https://pypi.org/project/kframework/$VERSION"; then
break
fi
sleep 10
done
notify-dependents:
name: 'Notify Dependents'
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion deps/haskell-backend_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.19
v0.1.25
2 changes: 1 addition & 1 deletion deps/llvm-backend_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.51
0.1.52
16 changes: 8 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
description = "K Framework";
inputs = {
haskell-backend.url = "github:runtimeverification/haskell-backend/v0.1.19";
haskell-backend.url = "github:runtimeverification/haskell-backend/v0.1.25";
nixpkgs.follows = "llvm-backend/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
llvm-backend = {
url = "github:runtimeverification/llvm-backend/v0.1.51";
url = "github:runtimeverification/llvm-backend/v0.1.52";
inputs.utils.follows = "flake-utils";
};
rv-utils.url = "github:runtimeverification/rv-nix-tools";
Expand Down
2 changes: 1 addition & 1 deletion k-distribution/include/kframework/builtin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ module RANGEMAP
### Range, bounded inclusively below and exclusively above.

```k
syntax Range ::= "[" KItem "," KItem ")" [klabel(Rangemap:Range), symbol]
syntax Range ::= "[" KItem "," KItem ")" [klabel(RangeMap:Range), symbol]
syntax RangeMap [hook(RANGEMAP.RangeMap)]
```
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion llvm-backend/src/main/native/llvm-backend
Submodule llvm-backend updated 63 files
+1 −1 package/debian/changelog
+1 −1 package/version
+2 −2 runtime/collections/rangemaps.cpp
+2 −2 runtime/util/ConfigurationSerializer.cpp
+10 −10 test/defn/imp-with-rangemaps.kore
+24 −24 test/defn/rangemap-simple.kore
+1 −1 test/input/rangemap-simple/rangemap-simple-15.in
+1 −1 test/input/rangemap-simple/rangemap-simple-69.in
+1 −1 test/input/rangemap-simple/rangemap-simple-70.in
+1 −1 test/input/rangemap-simple/rangemap-simple-71.in
+1 −1 test/input/rangemap-simple/rangemap-simple-72.in
+1 −1 test/input/rangemap-simple/rangemap-simple-74.in
+1 −1 test/input/rangemap-simple/rangemap-simple-75.in
+1 −1 test/input/rangemap-simple/rangemap-simple-77.in
+1 −1 test/input/rangemap-simple/rangemap-simple-78.in
+1 −1 test/input/rangemap-simple/rangemap-simple-85.in
+1 −1 test/input/rangemap-simple/rangemap-simple-86.in
+1 −1 test/input/rangemap-simple/rangemap-simple-87.in
+1 −1 test/input/rangemap-simple/rangemap-simple-88.in
+1 −1 test/input/rangemap-simple/rangemap-simple-89.in
+1 −1 test/input/rangemap-simple/rangemap-simple-90.in
+1 −1 test/input/rangemap-simple/rangemap-simple-91.in
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-1.out.diff
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-2.out.diff
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-3.out.diff
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-4.out.diff
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-5.out.diff
+1 −1 test/output/imp-with-rangemaps/imp-with-rangemaps-6.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-10.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-11.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-12.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-13.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-14.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-15.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-16.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-17.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-3.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-4.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-45.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-46.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-48.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-49.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-5.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-6.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-7.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-70.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-72.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-76.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-77.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-78.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-85.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-86.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-87.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-88.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-89.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-90.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-91.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-93.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-94.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-95.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-96.out.diff
+1 −1 test/output/rangemap-simple/rangemap-simple-97.out.diff
+1 −1 unittests/runtime-collections/rangemap-hooks.cpp
4 changes: 3 additions & 1 deletion pyk/src/pyk/kast/manip.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def sort_assoc_label(label: str, kast: KInner) -> KInner:

def sort_ac_collections(kast: KInner) -> KInner:
def _sort_ac_collections(_kast: KInner) -> KInner:
if type(_kast) is KApply and (_kast.label.name in {'_Set_', '_Map_'} or _kast.label.name.endswith('CellMap_')):
if type(_kast) is KApply and (
_kast.label.name in {'_Set_', '_Map_', '_RangeMap_'} or _kast.label.name.endswith('CellMap_')
):
return sort_assoc_label(_kast.label.name, _kast)
return _kast

Expand Down
11 changes: 10 additions & 1 deletion pyk/src/pyk/kast/outer.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,16 @@ def cell_collection_productions(self) -> tuple[KProduction, ...]:
def _is_function(prod: KProduction) -> bool:
def is_not_actually_function(label: str) -> bool:
is_cell_map_constructor = label.endswith('CellMapItem') or label.endswith('CellMap_')
is_builtin_data_constructor = label in {'_Set_', '_List_', '_Map_', 'SetItem', 'ListItem', '_|->_'}
is_builtin_data_constructor = label in {
'_Set_',
'_List_',
'_Map_',
'_RangeMap_',
'SetItem',
'ListItem',
'_|->_',
'_r|->_',
}
return is_cell_map_constructor or is_builtin_data_constructor

return (Atts.FUNCTION in prod.att or Atts.FUNCTIONAL in prod.att) and not (
Expand Down
32 changes: 32 additions & 0 deletions pyk/src/pyk/kore/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,28 @@ def match_map(pattern: Pattern, *, cell: str | None = None) -> tuple[tuple[Patte
return tuple(entries)


def match_rangemap(pattern: Pattern) -> tuple[tuple[tuple[Pattern, Pattern], Pattern], ...]:
stop_symbol = "Lbl'Stop'RangeMap"
cons_symbol = "Lbl'Unds'RangeMap'Unds'"
item_symbol = "Lbl'Unds'r'Pipe'-'-GT-Unds'"

if type(pattern) is App:
match_app(pattern, stop_symbol)
return ()

assoc = match_left_assoc(pattern)
cons = match_app(assoc.app, cons_symbol)
items = (match_app(arg, item_symbol) for arg in cons.args)
entries = ((_match_range(item.args[0]), item.args[1]) for item in items)
return tuple(entries)


def _match_range(pattern: Pattern) -> tuple[Pattern, Pattern]:
range_symbol = "LblRangeMap'Coln'Range"
range = match_app(pattern, range_symbol)
return (range.args[0], range.args[1])


def kore_bool(pattern: Pattern) -> bool:
dv = match_dv(pattern, BOOL)
match dv.value.value:
Expand Down Expand Up @@ -253,6 +275,16 @@ def res(pattern: Pattern) -> tuple[tuple[K, V], ...]:
return res


def kore_rangemap_of(
key: Callable[[Pattern], K],
value: Callable[[Pattern], V],
) -> Callable[[Pattern], tuple[tuple[tuple[K, K], V], ...]]:
def res(pattern: Pattern) -> tuple[tuple[tuple[K, K], V], ...]:
return tuple(((key(k[0]), key(k[1])), value(v)) for k, v in match_rangemap(pattern))

return res


def case_symbol(
*cases: tuple[str, Callable[[App], T]],
default: Callable[[App], T] | None = None,
Expand Down
18 changes: 18 additions & 0 deletions pyk/src/pyk/kore/prelude.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,24 @@ def map_pattern(*args: tuple[Pattern, Pattern], cell: str | None = None) -> Patt
return LeftAssoc(cons_symbol, args=(App(item_symbol, args=arg) for arg in args))


STOP_RANGEMAP: Final = App("Lbl'Stop'RangeMap")
LBL_RANGEMAP: Final = SymbolId("Lbl'Unds'RangeMap'Unds'")
LBL_RANGEMAP_ITEM: Final = SymbolId("Lbl'Unds'r'Pipe'-'-GT-Unds'")
LBL_RANGEMAP_RANGE: Final = SymbolId("LblRangeMap'Coln'Range")


def rangemap_pattern(*args: tuple[tuple[Pattern, Pattern], Pattern]) -> Pattern:
if not args:
return STOP_RANGEMAP

return LeftAssoc(
App(
LBL_RANGEMAP,
args=(App(LBL_RANGEMAP_ITEM, args=(App(LBL_RANGEMAP_RANGE, args=arg[0]), arg[1])) for arg in args),
)
)


# ----
# JSON
# ----
Expand Down
Loading

0 comments on commit 2ed6d2b

Please sign in to comment.