Skip to content

Commit

Permalink
Merge branch 'develop' into follows-pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltoli authored Jul 2, 2024
2 parents bfed09c + 25bbf54 commit 1de846e
Show file tree
Hide file tree
Showing 30 changed files with 310 additions and 82 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,9 +1,9 @@
{
description = "K Framework";
inputs = {
llvm-backend.url = "github:runtimeverification/llvm-backend/v0.1.51";
llvm-backend.url = "github:runtimeverification/llvm-backend/v0.1.52";
haskell-backend = {
url = "github:runtimeverification/haskell-backend/v0.1.19";
url = "github:runtimeverification/haskell-backend/v0.1.25";
inputs.rv-utils.follows = "llvm-backend/rv-utils";
};

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.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#putCells
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<generatedTop>
<k>
<cell>
<num>
0
</num>
<data>
0
</data>
</cell> <cell>
<num>
1
</num>
<data>
1
</data>
</cell> ~> .K
</k>
<cells>
.CellCellMap
</cells>
</generatedTop>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEF=test
EXT=test
TESTDIR=.
KOMPILE_BACKEND=llvm
KOMPILE_FLAGS=--syntax-module TEST

include ../../../include/kframework/ktest.mak
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
module TEST
imports INT

configuration
<k> $PGM:K </k>
<cells>
<cell multiplicity="*" type="Map">
<num> 0 </num>
<data> 0 </data>
</cell>
</cells>

syntax CellCellMap ::= #makeCell( Int, Int ) [function]
// ----------------------------
rule #makeCell( X, Y ) => CellCellMapItem(
<num> X </num>,
<cell> <num> X </num> <data> Y </data> </cell>
)

syntax KItem ::= "#putCells"
// ----------------------------
rule <k> #putCells => #makeCell(0,0) (#makeCell(1,1) .CellCellMap) </k>
endmodule
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,6 @@ public static Tuple3<Module, Module, Module> getCombinedGrammarImpl(
Stream.concat(prods.stream(), stream(mod.sentences()))
.flatMap(
s -> {
if (s instanceof Production && s.att().contains(Att.CELL_COLLECTION())) {
return Stream.empty();
}
if (s instanceof Production p && (s.att().contains(Att.CELL()))) {
// assuming that productions tagged with 'cell' start and end with terminals,
// and only have non-terminals in the middle
Expand Down
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: 0 additions & 4 deletions pyk/regression-new/include/ktest.mak
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ SOURCE_EXT?=$(or $(and $(wildcard $(DEF).k), k), $(or $(and $(wildcard $(DEF).md

VERBOSITY?=

ifeq ($(UNAME), Darwin)
KOMPILE_FLAGS+=--no-haskell-binary
endif

KOMPILE_FLAGS+=--no-exc-wrap --type-inference-mode checked $(VERBOSITY)
KRUN_FLAGS+=$(VERBOSITY)
KPROVE_FLAGS+=--type-inference-mode checked --failure-info $(VERBOSITY)
Expand Down
1 change: 1 addition & 0 deletions pyk/regression-new/star-multiplicity-concat/1.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#putCells
25 changes: 25 additions & 0 deletions pyk/regression-new/star-multiplicity-concat/1.test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<generatedTop>
<k>
<cell>
<num>
0
</num>
<data>
0
</data>
</cell> <cell>
<num>
1
</num>
<data>
1
</data>
</cell> ~> .K
</k>
<cells>
.CellCellMap
</cells>
<generatedCounter>
0
</generatedCounter>
</generatedTop>
7 changes: 7 additions & 0 deletions pyk/regression-new/star-multiplicity-concat/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DEF=test
EXT=test
TESTDIR=.
KOMPILE_BACKEND=llvm
KOMPILE_FLAGS=--syntax-module TEST

include ../include/ktest.mak
24 changes: 24 additions & 0 deletions pyk/regression-new/star-multiplicity-concat/test.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
module TEST
imports INT

configuration
<k> $PGM:K </k>
<cells>
<cell multiplicity="*" type="Map">
<num> 0 </num>
<data> 0 </data>
</cell>
</cells>

syntax CellCellMap ::= #makeCell( Int, Int ) [function]
// ----------------------------
rule #makeCell( X, Y ) => CellCellMapItem(
<num> X </num>,
<cell> <num> X </num> <data> Y </data> </cell>
)

syntax KItem ::= "#putCells"
// ----------------------------
rule <k> #putCells => #makeCell(0,0) (#makeCell(1,1) .CellCellMap) </k>
endmodule
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 @@ -252,6 +252,24 @@ def map_pattern(*args: tuple[Pattern, Pattern], cell: str | None = None) -> Patt
return LeftAssoc(App(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 1de846e

Please sign in to comment.