[K-Improvement] <Allow Fragment-Style Configuration Cell Operations for Concatenation? >

Open
#4,151 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Domain
compilers

Research direction

Start with the SIMPLE-DYNAMIC tutorial's ControlCellFragment examples and reproduce the kompile mismatch for the concatenated C and A fragment. Trace how configuration fragments are matched; done should be a confirmed single-rule approach or a precisely scoped change that supports the requested concatenation.

Written by the indexing model from the issue text.

Description

Configuration cell operations are very common in semantic implementations. Stack push/pop operations are required when implementing function calls/returns. In the SIMPLE-DYNAMIC tutorial, because it only needs to change the values of the fstack and returnType cell, it uses ControlCellFragment to quickly select other parts of the control cell, as shown below:

<control>
    <fstack> .List => ListItem(fstackFrame(T',Env,K,C)) ...</fstack>
    <returnType> T' => T </returnType>
    C
</control>

Here, fstackFrame is the structure for stack information, with its definition consistent with SIMPLE-DYNAMIC:

syntax KItem ::= fstackFrame(Type,Map,K,ControlCellFragment)

However, in my project, the control cell has been expanded with several other modules, structured as:

<control>
    <fstack>  .List ...</fstack>
    <xstack>  .List ...</xstack>
    <lstack>  .List ...</lstack>
    <otherStacks>  .List ...</otherStacks>
    // some other cells here
    <returnType> T => T' </returnType>
</control>

In most cases, my function call operations, like those in SIMPLE-DYNAMIC, only need to modify the fstack and returnType values. However, in a few instances, modifications and stack operations are required for other parts of the control cell simultaneously, as below:

<control>
    <fstack> .List => ListItem(fstackFrame(T',Env,K, <This place should store `C` and `<A> OLDA </A>`>)) ...</fstack>
    <returnType> T' => T </returnType>
    C
    <A>
        OLDA => 
        <A1>  some new value here </A1>
        <A2>  some new value here </A2>
    </A>
</control>

The issue arises when I find that C <A> OLDA </A> cannot be recognized as a ControlCellFragment class; kompile tells me it does not match, even though concatenating them still forms part of the control cell.

I wish to maintain consistency in push/pop operations, so I prefer not to modify the definition of fstackFrame. Due to certain limitations in my language, I aim to complete this modification and stack operation in a single rule (i.e., it cannot be split into two KItems to perform the configuration modifications).

Could you advise on allowing fragment-style configuration cell operations for concatenation, or suggest an alternative approach to achieve this within a single rule?

Dominant language
Python
Stars
591
Forks
163
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from runtimeverification/k

All issues in runtimeverification/k

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.