Skip to content

Commit 344cc7e

Browse files
Factor out runtime from Tools (#66)
This makes it easier to instantiate `Tools` with an alternative definition. --------- Co-authored-by: devops <[email protected]>
1 parent b8bf5d2 commit 344cc7e

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.52
1+
0.1.53

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "kriscv"
7-
version = "0.1.52"
7+
version = "0.1.53"
88
description = "K tooling for the RISC-V architecture"
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

src/kriscv/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818

1919
def semantics(*, temp_dir: Path | None = None) -> Tools:
20-
return Tools(definition_dir=kdist.get('riscv-semantics.llvm'), runtime=runtime, temp_dir=temp_dir)
20+
return Tools(definition_dir=kdist.get('riscv-semantics.llvm'), temp_dir=temp_dir)

src/kriscv/tools.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
if TYPE_CHECKING:
1818

1919
from pyk.kast.inner import KInner
20-
from pyk.kllvm.runtime import Runtime
2120
from pyk.ktool.kprint import KPrint
2221

2322

2423
class Tools:
2524
__krun: KRun
26-
__runtime: Runtime
2725

28-
def __init__(self, definition_dir: Path, runtime: Runtime, *, temp_dir: Path | None = None) -> None:
26+
def __init__(self, definition_dir: Path, *, temp_dir: Path | None = None) -> None:
2927
self.__krun = KRun(definition_dir, use_directory=temp_dir)
30-
self.__runtime = runtime
3128

3229
@property
3330
def krun(self) -> KRun:
@@ -37,10 +34,6 @@ def krun(self) -> KRun:
3734
def kprint(self) -> KPrint:
3835
return self.__krun
3936

40-
@property
41-
def runtime(self) -> Runtime:
42-
return self.__runtime
43-
4437
def init_config(self, config_vars: dict[str, KInner]) -> KInner:
4538
conf = self.krun.definition.init_config(sort=GENERATED_TOP_CELL)
4639
return Subst(config_vars)(conf)

src/tests/unit/test_unit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pyk.kore.match import kore_int
1212
from pyk.prelude.kint import INT, intToken
1313

14-
from kriscv import term_builder
14+
from kriscv import build, term_builder
1515
from kriscv.term_builder import register
1616
from kriscv.term_manip import kore_sparse_bytes, normalize_memory
1717

@@ -30,7 +30,7 @@ def _eval_call(tools: Tools, call: KInner, sort: KSort) -> KInner:
3030

3131
def _eval_call_to_kore(tools: Tools, call: KInner, sort: KSort) -> Pattern:
3232
llvm_input = pattern_to_llvm(tools.krun.kast_to_kore(call, sort))
33-
llvm_res = tools.runtime.evaluate(llvm_input)
33+
llvm_res = build.runtime.evaluate(llvm_input)
3434
return llvm_to_pattern(llvm_res)
3535

3636

0 commit comments

Comments
 (0)