Skip to content

Commit

Permalink
Top-down semantics rewrite in kmir.md (#435)
Browse files Browse the repository at this point in the history
Co-authored-by: devops <[email protected]>
  • Loading branch information
jberthold and devops authored Jan 24, 2025
1 parent a60bb24 commit 8f6e621
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 810 deletions.
2 changes: 1 addition & 1 deletion kmir/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kmir"
version = "0.3.61"
version = "0.3.62"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion kmir/src/kmir/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from typing import Final

VERSION: Final = '0.3.61'
VERSION: Final = '0.3.62'
2 changes: 1 addition & 1 deletion kmir/src/kmir/kdist/mir-semantics/body.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ syntax StatementKind ::= statementKindAssign(place: Place, rvalue: Rvalue)
[ group(mir-enum---place--variant-index)
, symbol(StatementKind::SetDiscriminant)
]
| deinit(place: Place)
| statementKindDeinit(place: Place)
[ group(mir-enum)
, symbol(StatementKind::Deinit)
]
Expand Down
1,097 changes: 352 additions & 745 deletions kmir/src/kmir/kdist/mir-semantics/kmir.md

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions kmir/src/tests/integration/data/run-panic/simple.kmir

This file was deleted.

28 changes: 1 addition & 27 deletions kmir/src/tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from typing import TYPE_CHECKING

import pytest
from pyk.cterm import CTerm
from pyk.kast.inner import KApply, KLabel, KSequence, KSort, KToken
from pyk.kast.inner import KApply, KSort, KToken

from kmir.convert_from_definition.v2parser import Parser

Expand Down Expand Up @@ -127,28 +126,3 @@ def test_schema_kapply_parse(
json_data, expected_term, expected_sort = test_case

assert parser.parse_mir_json(json_data, expected_sort.name) == (expected_term, expected_sort)


RUN_PANIC_DATA = (Path(__file__).parent / 'data' / 'run-panic').resolve(strict=True)
RUN_PANIC_INPUT = [RUN_PANIC_DATA / 'simple.kmir']


@pytest.mark.parametrize(
'test_file',
RUN_PANIC_INPUT,
ids=[str(test_file.relative_to(RUN_PANIC_DATA)) for test_file in RUN_PANIC_INPUT],
)
def test_run_panic(test_file: Path, tools: Tools) -> None:
def _is_panic(config: KInner) -> bool:
k_cell = CTerm(config).cell('K_CELL')

match k_cell:
case KSequence((KApply(KLabel(name='#stuck_KMIR_KItem')), *_)):
return True

return False

rc, result = tools.krun.krun(test_file)

assert rc == 0
assert _is_panic(result)
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.61
0.3.62

0 comments on commit 8f6e621

Please sign in to comment.