Skip to content

Commit d753b4e

Browse files
KJ-14 Investigate the ability to use generalized context rules for default elab heating.
Second round of investigation, some new attempts. Nothing works yet. rolled back to custom heating/cooling for elab.
1 parent abb8c55 commit d753b4e

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

.idea/dictionaries/Denis.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semantics/elaborate-blocks.k

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ syntax K ::= "elabInstanceInit"
5656
syntax K ::= "elab" "(" K ")"
5757

5858
//@ Wraps the elaboration result. Since elaboration may happen at both ElaborationPhase and ExecutionPhase, it cannot be KResult. Actually it is not KResult for HOLE, but is for CHOLE.
59-
syntax ElabRes ::= "elabRes" "(" K ")"
59+
syntax ElabKResult ::= "elabRes" "(" K ")"
6060

6161
//@Sets the enclosing object for a given object.
6262
//@Invoked by invokeConstr and QSuperConstrInv.
@@ -281,10 +281,9 @@ This is a rule that may lead to unexpected nondeterminism if it is wrongly imple
281281
In order to expose incorrect nondeterminism we need to model-check a program that exposes the nondeterminism.
282282
*/
283283
rule [elabHeat-default]:
284-
(. => elab(K)) ~> elab(KL:KLabel(HeadKs:KList,, (K:K => CHOLE),, TailKs:KList))
284+
(. => elab(K)) ~> elab(KL:KLabel(HeadKs:KList,, (K:K => CHOLE),, _:KList))
285285
when
286286
defaultElabChildren(KL)
287-
//notBool customElabChildren(KL)
288287
andBool notBool isElab(K)
289288
andBool notBool isElabNaked(K)
290289
andBool isElab(HeadKs) //Forces elaboration left-to-right. Required when KL == 'ListWrap of statements.
@@ -301,14 +300,17 @@ when
301300
heated terms oare of 2 cathegories: defaultElabChildren and naked. for naked terms we should not heat
302301
their children anymore, but should unwrap their elab() wrapper. This is accomplished well enough for the moment.
303302
*/
304-
/*context elab(KL:KLabel(HeadKs:KList,, HOLE:K,, _:KList))
303+
/*context elab(KL:KLabel(HeadKs:KList,, (HOLE:K => elab(HOLE)),, _:KList))
305304
when
306305
defaultElabChildren(KL)
307-
//notBool customElabChildren(KL)
306+
andBool notBool isElabNaked(HOLE)
308307
andBool isElab(HeadKs) //Forces elaboration left-to-right. Required when KL == 'ListWrap of statements.
309-
[result('isElab`(_`)), context(elab), transition-strictness]
308+
[result(ElabKResult), transition-strictness]
310309
311-
syntax ElabRes ::= TypedExp | KResult */
310+
syntax ElabKResult ::= TypedExp
311+
312+
//hack suggested by Traian, an alternative to subsorting KResult to ElabKResult
313+
rule isElabKResult(K:KResult) => true*/
312314
313315
/*@ Terms that should use custom elaboration rules. For those terms:
314316
- They will not be automatically heated from their parents into the elab() state.
@@ -334,9 +336,12 @@ rule customElabChildren(KL:KLabel) =>
334336
/*@ Java KLabels that are processed by default heating/cooling rules of elaboration.
335337
All KLabels that can be part of a code block during elaboration phase,
336338
except those members of customElabChildren or isElabNaked groups.
339+
340+
This predicate should be disjoint with customElabChildren (no longer used) and isElabNaked
341+
342+
todo: maybe statements should be processed by default rules as they are now, but expressions should not.
343+
Let's start from expressions.
337344
*/
338-
//todo: maybe statements should be processed by default rules as they are now, but expressions should not.
339-
//Let's start from expressions.
340345
syntax K ::= "defaultElabChildren" "(" KLabel ")" [function]
341346
rule defaultElabChildren(KL:KLabel) =>
342347
(KL ==KLabel 'ListWrap)

0 commit comments

Comments
 (0)