[Bug] [kompile] - Parsing token vs parsing variable name
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- compilers
Research direction
Start by reproducing the failure with test.k using kompile --backend haskell, then inspect the reported parsing locations in include/kframework/builtin/domains.md. Determine why the token C conflicts with variable names across sorts, and consider the issue done when the definition compiles without the reported parser errors.
Written by the indexing model from the issue text.
Description
K Version
bd04f5fd32
Description
Tokens declared in one sort conflict with variables in another sort.
Input Files
File test.k:
module TEST
imports INT
configuration <k> $PGM:Contract </k>
rule (A +Int B) +Int C:Int => A +Int (B +Int C:Int) [simplification]
syntax Contract ::= "C"
endmodule
Reproduction Steps
Kompile the definition:
$ kompile --backend haskell test.k --output-definition test-kompiled
[Error] Inner Parser: Parse error: unexpected token 'C' following token '+Int'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1097,25,1097,26)
1097 | rule I1 +Int (I2 +Int C) => (I1 +Int I2) +Int C [concrete(I1, I2),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '-Int'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1098,25,1098,26)
1098 | rule I1 +Int (I2 -Int C) => (I1 +Int I2) -Int C [concrete(I1, I2),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '+Int'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1100,25,1100,26)
1100 | rule I1 -Int (I2 +Int C) => (I1 -Int I2) -Int C [concrete(I1, I2),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '-Int'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1101,25,1101,26)
1101 | rule I1 -Int (I2 -Int C) => (I1 -Int I2) +Int C [concrete(I1, I2),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '('.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1102,9,1102,10)
1102 | rule (C -Int I2) -Int I3 => C -Int (I2 +Int I3) [concrete(I2, I3),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '&Int'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(1104,25,1104,26)
1104 | rule I1 &Int (I2 &Int C) => (I1 &Int I2) &Int C [concrete(I1, I2),
symbolic(C), simplification]
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '#if'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(2128,12,2128,13)
2128 | rule #if C:Bool #then B1::K #else _ #fi => B1 requires C
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '#if'.
Source(/home/dev/src/k/k-distribution/target/release/k/include/kframework/builtin/domains.md)
Location(2129,12,2129,13)
2129 | rule #if C:Bool #then _ #else B2::K #fi => B2 requires notBool C
. ^
[Error] Inner Parser: Parse error: unexpected token 'C' following token '+Int'.
Source(/home/dev/src/k/test.k)
Location(6,26,6,27)
6 | rule (A +Int B) +Int C => A +Int (B +Int C) [simplification]
. ^
[Error] Compiler: Had 9 parsing errors.
Expected Behavior
I would like this case to be handled. The variable C in these rules cannot be of sort Contract, so we should be able to figure this out. Annotating the variable with it's sort (as C:Int), does not help.
- Dominant language
- Python
- Stars
- 591
- Forks
- 163
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from runtimeverification/k
-
runtimeverification/k#4939 · 1 assignee ·
-
Concolic Explorer Open
Difficulty 5/5 Over a week Newbie friendliness 32/100
runtimeverification/k#4937 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
runtimeverification/k#4936 ·
-
type:epic
runtimeverification/k#4934 · 4 comments · 1 assignee ·
-
runtimeverification/k#4924 · 1 assignee ·
All issues in runtimeverification/k
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100