-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
discussion #1
base: master
Are you sure you want to change the base?
discussion #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,13 @@ mod KORE is | |
--- For example, we cannot write `_+_` in Maude; so we'll write #Label("_+_"). | ||
--- For maximum clarity, we will also include a separate sort for each type of token. | ||
including STRING . | ||
sorts Label Token Variable Application Item K KList . --- we call these "K Label", etc. | ||
sorts Label Token Variable Application Item K KList Sort . --- we call these "K Label", etc. | ||
subsorts Token Variable Application < Item < K < KList . | ||
op #Label : String -> Label . | ||
op #Token : String String -> Token . | ||
op #Variable : String String -> Variable . | ||
op _`(_`) : Label KList -> Application . | ||
op #Token : Sort String -> Token . --- Cosmin: if we have sorts, it may be good to have them explicitly "String String" is confusing | ||
op #Sort : String -> Sort . | ||
op #Variable : Sort String -> Variable . | ||
op _`(_`) : Label KList -> Application . --- Cosmin: would it be correct to "Application => Term"? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For uniformity, I would keep it Application. The other two (Token and Variable) are also Term constructs. We may replace Item with Term, but that would be confusing, because one can argue that K is also a term. |
||
op .K : -> K . --- .::K instead of .K gives a parsing error | ||
op _~>_ : K K -> K [assoc id: .K] . --- "assoc" has only parsing meaning here; id not needed | ||
op .KList : -> KList . | ||
|
@@ -19,6 +20,7 @@ mod KORE is | |
--- Not sure about _~>_ and _,_ being associative at this level. Like for other K | ||
--- definitions, we may want to have a syntax for parsing KORE and another syntax | ||
--- for the semantics of KORE | ||
--- Cosmin: yes, the assoc problem for KList seems the same as the usual user lists problem, just at the meta-level | ||
---------------------------------- | ||
|
||
*** K rewriting | ||
|
@@ -34,6 +36,8 @@ mod KORE is | |
op next_ : K -> K . | ||
op exists__ : Variable K -> K . | ||
--- requires/ensures = sugar: "C[K1 => K2] requires K3 ensures K4" is "C[K1 /\ K3 => K2 /\ K4]" | ||
--- Cosmin: yes, and it may be nice to move away from the sugar. "C[K1 /\ K3 => K2 /\ K4]" is both shorter and clearer. | ||
--- also, even in the current Java backend implementation, /\ would work well and be faster | ||
|
||
*** Attributes | ||
--- In the past, I proposed to just use KList for Attributes, but my proposal was rejected. | ||
|
@@ -44,6 +48,9 @@ mod KORE is | |
op .AttributeList : -> AttributeList . | ||
op _,_ : Attribute AttributeList -> AttributeList [format(d d s d)] . | ||
op [_] : AttributeList -> Attributes . | ||
--- Cosmin: from my perspective, if we allow parsing empty KLists from "" instead of ".KList" (the same trick we do for user lists), | ||
--- using labeled syntax for attributes should work well. It's annoying to write "foo(a, .KList)" and "foo(.KList)", but "foo(a)" | ||
--- and "foo()" work well. | ||
|
||
*** Outer | ||
sort Definition . | ||
|
@@ -220,23 +227,36 @@ Questions about this definition: | |
- do we really need ~> as a K construct? Can it be a label and thus the way K | ||
deal with evaluation contexts just a particular methodology and not an | ||
intrisic part of K ? Same question for =>. | ||
Cosmin: Syntacticly at least, I would say "no" for both. From the implementation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you say "no for both" you mean that we should NOT keep any of them as constructors, that is, that we should just replace them with particular labels? Since => actually has a meaning in K, I am tempted to at least keep this one as a constructor. Also, if we make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another issue with making There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From an implementation perspective, I do want to modify the KORE data structure to allow for traversal of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the distinction between K and KItem could still be maintained at the sort level. |
||
perspective, this will simplify traversal code even further. | ||
- rename .::K and .::KList to . ? if we get rid of ~> as above, then we may | ||
only need .::KList. | ||
Cosmin: I agree. | ||
- Should we allow empty productions instead of sort declarations? A pro | ||
argument is that we have fewer syntactic constructs. A cons argument is | ||
that a sort declaration may be regarded as a different entityr, with | ||
different kinds of attributes. | ||
Cosmin: I don't quite follow. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It refers to this syntax declaration of sorts:
That is, instead of
to write
(a normal production, but empty) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't quite like this because I have also been thinking of eliminating sort declarations, but not by replacing them with productions but by replacing them to with subsorts. Instead of writing:
it would be
As I said before, my preference would to be have a special
I understand we may want to have all sorts represented as undeleted injections, but I think we're very far from there and introducing a |
||
- Should we add constant AttributeKeys which have special semantics, like | ||
"strict", as constants? | ||
Cosmin: we may want to discuss the attribute syntax separately. | ||
- Brackets and disappearing injections are the same thing, arent's they? A | ||
production which only has one non-terminal and the production disappears | ||
from the AST. | ||
Cosmin: Yes, I also think they can be seen as the same thing. That being | ||
said, I would really like for injections to not dissapear. If something | ||
is meant to dissapear, it should be declared as a subsort. And the | ||
dissapearing injections (including subsorts) could be done via rules as | ||
we discussed before. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be reluctant to add a new construct, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've stared arguing for this again in the previous message. I agree it would be nice to do without sorts but the reality is that we do have them now. Keeping them as second-hand citizens for which magic things happen is confusing. Changing the default behavior of
I'm a bit worried about adding semantics to the attributes, but it could work as an intermediate solution from my perspective. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot to answer this. We already have many attributes that have semantic meaning. The "bracket" attribute is perhaps the closest in spirit to what "subsort" would do (i.e., not add a node in the AST). So I'd be tempted to keep it as is for now, that is, to have two different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. The question is: is the injection klabel from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. I think by default all productions should have unique labels associated to them. If you do not want a label, then you can put some attribute, like bracket or subsort, which will generate a rule that removes the label. I am not concerned about attaching semantics to labels, because we already do it anyway with several of them, and so does maude, obj, cafeobj, etc. Sent from my Verizon Wireless 4G LTE smartphone -------- Original message -------- In kore.maudehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_grosu_kore-2Din-2Dmaude_pull_1-23discussion-5Fr58822475&d=BQMCaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=gBub4ab7wvmjFVEDwsswdud0fptTHrGi3G4Zzc5Kwds&m=tMtUt_dmUvCV0T_JOIsgBhmzc6E1OutCg6ZyD-urFck&s=qKJvEl_2QoXxWYYUzeRrKbQiCLmlA7hIdeNiJwscfbo&e=:
Ok. The question is: is the injection klabel from syntax A ::= B (written exactly like this, with no attributes) automatically removed? — There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I can always write
and I would expect it to mean exactly the same thing as
Then what's the point in having two different internal representations for two things which are identical by all means? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. We could simply go with the first representation if we want to get rid of a special attribute. I don't have any strong preference here. My main concern is the production vs subsort sentence distinction. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'd prefer to keep KORE simpler. Whatever KORE we end up with after this discussion, is what I plan to call "the K Standard" that all implementations should support. I can easily see implementations which do not even want to have a "bracket" attribute. Regarding the subsort vs production, I would have a bold proposal: let us get rid of subsorts all together from KORE, and let implementations decide on their own if they want to implement subsorts. That is, let us simply require that each production has a klabel, including all the injection productions. The injections will also need to be strict. From a theoretical perspective, the order-sorted algebra community is well aware of the fact that subsorts can be simulated with injections, specifically by adding for any sorts S1 < S2 < S3 equations
and then everything happens modulo such equations, including matching. The rest is just implementation detail, and I believe that some may not want to implement subsorts in their backend; for example the Coq backend. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand this and agree. The problem is that we do have sorts now, and many passes in the compiler and the backend rely on them. Removing them is not something we can solve in the short term. As we don't want them there eventually, we can avoid adding the subsort sentence to the KORE syntax. But I do want it there for the implementation. This will actually help when eventually removing sorts, as we have the productions clearly identified (via Java typing, not just checking for an elusive attribute). So, my concrete proposal is:
What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with 1 and 2, but I would keep 3 as is, because in most definitions the sort K does not even appear. In the usual definitions, which are purely syntactic, the top sort K may even be looked at as just an implementation detail of the K framework. Also, the only reason for which we need sort declarations is because we want to attach them attributes, like hooks to builtin data-types. If we write it |
||
- Should #Label contain more structured information than just a String? | ||
Cosmin: From my perspective, its semantics and any other information should live | ||
with the definition (module), not within the label. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the answer is NO? I was thinking more about implementing kompile using Maude and this definition of KORE. In that case, instead of having a table holding for each KLabel where it comes from, including its argument sorts and its result sort, all that information could have already been part of the KLabel term. Or are you saying that we may only need to add the module name info to the KLabel term, and then we will be able to get the info from there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far, I kind of saw this as an implementation detail. Once "resolved" to a module, the information for the klabel is clear (modulo overloaded klabels). It's up to the particular backend to choose between looking up the information from the module every time, having a direct reference to the KLabel information, or doing something completely different (e.g., instantiates a different class). I can also see the advantage is keeping the information attached to the KLabel in KORE already. It would allow us to drop all syntax productions from a definition and it would still be valid. But it will come with a space overhead. I'm not sure it is worth it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is too much to keep all the syntax information attached to the KLabel. It would make the KORE definitions almost unreadable, with a lot of repetition and redundancy. I was thinking of keeping only some crucial information, like the arity, or the module where the operation comes from. But at second thoughts I think we should not keep anything except its name. Since both sorts and labels act the same way wrt qualification, as symbols, then we would have to also keep the module attached to sorts, etc. Since until now we managed to survive without any additional information attached to labels, we will likely continue to survive. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. Ok. |
||
Comments about old kast.k and e-kore.k: | ||
- Stop having particular module names mean particular things in KORE! You may do that in full K. | ||
- Why do you call ATTRIBUTES a module which only defines one attribute? | ||
- We agree on separating the attrbute listsand arguments with commas, not spaces. | ||
- The current attributes are a mixture of K (you use the "token" attribute) and something | ||
else. I continue to believe that attributes can be just a KList. | ||
Cosmin: the attributes are definetely messed up and we should discuss and agree on them | ||
- #emptyKProduction was never defined anywhere, but used in KProduction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to move the Sort declaration here, and then to use the actual sort construct in variables and tokens.