Closed yanliu18 closed 1 year ago
The error is happening during macro expansion; I'm not immediately sure why that's the case but I'll take a look at reproducing the problem.
Steps to take for debugging this:
kore-expand-macros
that's causing the issue - need to look at how kmir
handles options + verbosity to figure this outThe issue here is that the GLR parser for the MIR syntax has not been regenerated between builds. The branch relevant to this PR changes the production that Add(const 1_usize, const 1_usize)
would parse to; previously, it would have been _(_, _)_Identifier_Operand_Operand
, but it's now _(_, _)_BinaryOpName_Operand_Operand
.
When the stale parser is invoked, it will generate the old label, and the macro expander then breaks because that label doesn't exist in the semantics. The error message could admittedly be friendlier in this case!
Running kbuild clean
inside your Poetry shell should address this.
The problem happens because of this code: https://github.com/runtimeverification/mir-semantics/blob/e0d53af3b5d6a642a6d5d85317d88774767f55b7/kmir/src/kmir/kmir.py#L30-L32
It will fail to generate the GLR parser if that file already exists in the Pyk kbuild
cache; I believe that kbuild
now supports a TOML config option to handle the generation of the parser in the build system: https://github.com/runtimeverification/pyk/blob/49d861944bad260be137f68f4adc37b360e25771/src/pyk/kbuild/project.py#L132
@Baltoli Thanks, kbuild clean
works. And your suggestion are accepted to put on our list. Thanks.
I attempted to implement the builtin operations using identifier tokens directly such that we can remove syntax ambiguities. The new way of implmentation is here: https://github.com/runtimeverification/mir-semantics/blob/c558fe6ce6cd72c351f714e991ab2726c1d99256/kmir/k-src/mir-rvalue.md?plain=1#L89-L105
kmir parse
is successful in returning the right tokens, howeverkmir run
return an error:The original implemtation at master branch has no such error, I wander why.
Process to reproduce the error:
On branch 90-make-sure-that-all-tokens-in-the-semantics-are-whitelisted-as-identifiers, under director mir-semantics/kmir
Checking K version
returns