Skip to Content.
Sympa Menu

k-user - Re: [K-user] Difference between 'macro', 'anywhere', and 'function'?

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] Difference between 'macro', 'anywhere', and 'function'?


Chronological Thread 
  • From: Traian Florin Șerbănuță <traian.serbanuta AT info.uaic.ro>
  • To: Andrei Arusoaie <andrei.arusoaie AT gmail.com>
  • Cc: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Difference between 'macro', 'anywhere', and 'function'?
  • Date: Sat, 28 Dec 2013 12:47:39 +0200
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

I think Andrei has explained it better than I would have.  Function rules are anywhere rules, but anywhere rules are not constrained to functions.  

However, one might think that one could handle functions differently (e.g., by requiring certain backends to supply code for handling them) while anywhere rules might be completely forbidden, or strongly discouraged.

I've added some info about that in the to-be-processed.txt file.

best wishes, 
Traian


2013/12/28 Andrei Arusoaie <andrei.arusoaie AT gmail.com>
Michael,

I can tell you my part of the story. The [function] attribute can be attached to syntax declarations. All the rules corresponding to that function are annotated automatically as [anywhere] which is only a rule attribute. However, if we want to say that a rule applies anywhere without being related to a function declaration, we simply annotate it with [anywhere] and the contextual transformation will not affect that rule. Therefore the functionality of [function] is implemented using [anywhere], and [anywhere] is an attribute which does not fill the context for that rule.

Andrei A.


2013/12/28 Michael D. Adams <adamsmd AT illinois.edu>

Does desugaring also apply to rules?  (I suspect that this could be a major difference between 'macro' and the others.)

I don't understand what you are saying about 'function' and 'anywhere'.  Is there any (current or planed for the future) difference in their behavior?

(Saying that 'function' is for functions and 'anywhere' applies anywhere doesn't help since we may have different understandings of what being a function and applying anywhere mean.)  An example showing how they behave differently might be enlightening.

Michael


On 12/25/2013 02:24 PM, Traian Florin Șerbănuță wrote:
They all generate the same code now.  However, they are semantically
different:

macro should only be used for desugaring, and should be applied to
programs before any evaluation is started.

function should only be used for annotating function declarations

anywhere should be used for rules which we want to apply anywhere,
disabling configuration concretization for them.

best wishes,
Traian

anywhere is


2013/12/25 Park, Daejun <dpark69 AT illinois.edu <mailto:dpark69 AT illinois.edu>>


    Hi,

    I have a simple question:
    What is the difference between 'macro', 'anywhere', and 'function'?
    The generated maude code seems to be same except metadata. Who
    makes, if any, a difference?

    Thanks,
    Daejun
    _______________________________________________
    k-user mailing list
    k-user AT cs.uiuc.edu <mailto:k-user AT cs.uiuc.edu>
    http://lists.cs.uiuc.edu/mailman/listinfo/k-user





_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user


_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user


_______________________________________________
k-user mailing list
k-user AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/k-user





Archive powered by MHonArc 2.6.16.

Top of Page