k-user AT lists.cs.illinois.edu
Subject: K-user mailing list
List archive
- From: Joseph Osborn <joe.osborn AT me.com>
- To: "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
- Subject: [K-user] "Don't-Care" unifiers in K
- Date: Sat, 09 Feb 2013 12:14:41 -0800
- List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
- List-id: <k-user.cs.uiuc.edu>
A common feature of languages with pattern-matching (even K!) is the
"don't-care" variable "_", which matches anything, each instance of which is
fresh. It doesn't seem like the UNIFICATION module supports these wildcards,
so here's a little patch that puts them in (in a somewhat ad hoc way
explicitly for unification, rather than by doing that formal replacement of
terms by fresh terms, because it seemed simpler).
Languages which want it should have a line like the following, though of
course "_" is only an example:
> syntax SomethingThatGetsUnified ::= "_" [onlyLabel, klabel($dontcare)]
There's probably a more K-like way to do that attribute ([dontcare] or
[wildcard] or something?), but that's all I know how to do right now. All the
LOGIK examples I tried (and those of my own language) seem to still work, but
I have not tested exhaustively.
Diff's attached, I hope it doesn't get scrubbed by the listserv!
Attachment:
unification-dontcare.diff
Description: Binary data
- [K-user] "Don't-Care" unifiers in K, Joseph Osborn, 02/09/2013
- Re: [K-user] "Don't-Care" unifiers in K, Traian Florin Șerbănuță, 02/18/2013
Archive powered by MHonArc 2.6.16.