Skip to Content.
Sympa Menu

k-user - Re: [[K-user] ] Quoting in K

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [[K-user] ] Quoting in K


Chronological Thread 
  • From: Derek Sorensen <derek AT pyrofex.net>
  • To: "Chen, Xiaohong" <xc3 AT illinois.edu>
  • Cc: "k-user AT lists.cs.illinois.edu" <k-user AT lists.cs.illinois.edu>
  • Subject: Re: [[K-user] ] Quoting in K
  • Date: Wed, 20 Jun 2018 15:04:06 -0600
  • Authentication-results: illinois.edu; spf=pass smtp.mailfrom=derek AT pyrofex.net; dkim=pass header.d=pyrofex-net.20150623.gappssmtp.com header.s=20150623; dmarc=none

Alternatively, is there a way to check if two variables are the same in K?

> On Jun 20, 2018, at 2:52 PM, Derek Sorensen
> <derek AT pyrofex.net>
> wrote:
>
> Hey Xiaohong,
>
> With regards to this, what would I write for the semantics of toString( X )
> where X:Id?
>
> Best,
> Derek
>
>> On May 29, 2018, at 9:07 AM, Derek Sorensen
>> <derek AT pyrofex.net>
>> wrote:
>>
>> This does help very much, thank you.
>>
>>> On May 24, 2018, at 7:27 PM, Chen, Xiaohong
>>> <xc3 AT illinois.edu>
>>> wrote:
>>>
>>> Hi Derek,
>>>
>>> One possible solution would be to define a symbol
>>>
>>> syntax String ::= toString(K)
>>>
>>> and define for each language construct their string representation,
>>> which should be straightforward. For example,
>>>
>>> rule toString(if B then S1 else S2)
>>> => "if" +String "(" +String toString(B) +String ")" +String toString(S1)
>>> +String toString(S2)
>>>
>>> Maybe K has a toString() function built in. You might want to examine
>>> the k-distribution/include/builtin/domains.k to see if there's anything
>>> related.
>>>
>>> Hope it helps.
>>> Xiaohong
>>>
>>> -------------------------
>>> Chen, Xiaohong
>>> BSc, Peking University
>>> PhD student, UIUC
>>>
>>> ________________________________________
>>> From: Derek Sorensen
>>> [derek AT pyrofex.net]
>>> Sent: Thursday, May 24, 2018 5:28 PM
>>> To:
>>> k-user AT lists.cs.illinois.edu
>>> Subject: [[K-user] ] Quoting in K
>>>
>>> Hi all,
>>>
>>> I would like to quote something in a rewrite rule—in particular, I would
>>> like to take two statements S1 and S2 and see if they are equal as
>>> strings. Is there a way to do this? I would like to define some sort of
>>> rule where S1 => “S1” in the sense that it’s the string corresponding to
>>> the statement S1, but no the literal string “S1”.
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Best,
>>> Derek Sorensen
>>
>




Archive powered by MHonArc 2.6.19.

Top of Page