k-legacy
k-legacy copied to clipboard
Rename/split Bag to Cells
Currently the sort name Bag
is used mostly if not exclusively for unorganized collections of cells, as defined in module KCELLS
in kast.k
, which is included below. We should rename the sort that's used for the K definition of the friendly surface syntax of incomplete cells into Cells
, and separate it from the use of Bag
as the nice simple domain of multisets.
module KCELLS
imports KAST
syntax Cell
syntax Bag ::= Bag Bag [left, assoc, klabel(#cells), unit(#cells)]
| ".Bag" [klabel(#cells)]
| ".::Bag" [klabel(#cells)]
| Cell
syntax Bag ::= "(" Bag ")" [bracket]
syntax K ::= Bag
syntax Bag ::= KBott
endmodule
┆Issue is synchronized with this Asana task
Please go ahead and do this, as this is a step ahead over what we have now anyway.
@bmmoore, assigned you so we have someone tracking this issue.
Hi @bmmoore , I have difficulty in understanding this requirement and have several questions. Could you help me to understand this bug?
(1) What is a Sort? Is Sort a data structure/type that represents the syntax definition in a specific module? For example, does Sort BAG mean the Syntax representation of Bag in module KCELLS? However, there is also a class CellDataStructure which is only extended by CellList and Context. Is CellDataStructure a data structure for configuration whereas Sort is a builtin data structure for syntax definition? Then what is a CellSort and what do you mean by incomplete cells in the bug description?
(2) What is the difference between Bag
and Cells
in ideal? Do you mean it's better to split the built-in Bag
into Bag
and Cells
? When do we prefer Bag
and when do we prefer Cells
? Could you provide more detailed explanations and examples?
(3) If we support Cells
, do we support .Cells
as a nothing type within <state> </state>
for a configuration?
(4) If we implement Sort Cells
, should we create a new class called Cells? As Bag
contains BagItems
, should Cells
contains CellItems
or simply Cell
?
(5) What is the relation between java version class Bag and scala version Att.Bag? Should we modify both and create Att.Cells?
(6) Is the expected result is to behave exactly the same as the current program without Cells
whenever we import KCELLS module? For example, whenever we run kast program?
Thank you!
@cos (and @bmmoore if you are still reading this), can you please help @HelenRouty with this question? Thanks.
Hi @cos, currently our biggest problem is what the changes of this Sort Bag would affect? What definition files and pgm that we should use to have the kompile program to read the Bag syntax?Thank you.
@bmmoore implemented most of this so he understands the various data structures much better. I'll forward a link to this issue to his email.
Hi @cos, thank you! I have talked to bmmoore today. He taught us the difference between data structure Bag and the syntax Bag. To distinguish them, he said we should rename all the Sort Bag defined in module KCELLS to CellBag. Then we should fix corresponding errors when running all the unit tests.