k-legacy
k-legacy copied to clipboard
Custom list in configuration, strange bug
I think I found another bug in K4.0. See the following code:
module TEST
imports TEST-SYNTAX
configuration
<T>
<k> $PGM:Pgm </k>
<p> .Ids </p>
</T>
rule <k> Ps:Ids => .Ids </k>
<p> Ps </p>
endmodule
module TEST-SYNTAX
syntax Pgm ::= Ids
syntax Ids ::= List{Id, ","}
syntax Ints ::= List{Int,","}
endmodule
kompile will return the following error:
[Error] Compiler: Had 1 parsing errors.
[Error] Critical: Unexpected sort Ids for term Ps. Expected Ints.
Source(test.k)
Location(10,12,10,14)
Any of the following will fix the problem:
- Removing
<p> .Ids </p> - Removing
syntax Ints ::= List{Int,","} - Changing the
Intsdelimiter to something else like;
Following @cos's suggestion, I changed the line in the configuration which has the custom list .Ids to <p> .Ids:Ids </p>, to explicitly define the sort; and that solved the problem. As I understood, the bug was that in this case both .Ints and .Ids will have the same list ending which is why the parser confused them.
However another bug turned up when I tried the double colon operator. <p> .Ids::Ids </p> produces the same error.
this is still a bug, so let's leave it open