Skip to content

Commit 8252da5

Browse files
KJ-9 create predicate defaultElabChildren, opposite to customElabChildren
1 parent 3c634a6 commit 8252da5

1 file changed

Lines changed: 219 additions & 4 deletions

File tree

semantics/elaborate-blocks.k

Lines changed: 219 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,14 @@ rule [elabParamsEnd]:
281281
rule [elabHeatDefault]:
282282
(. => elab(K)) ~> elab(KL:KLabel(HeadKs:KList,, (K:K => CHOLE),, TailKs:KList))
283283
when
284-
notBool customElabChildren(KL)
284+
defaultElabChildren(KL)
285+
//notBool customElabChildren(KL)
285286
andBool notBool isElab(K)
286-
andBool notBool isElabNaked(KL(HeadKs,,K,,TailKs))
287+
//andBool notBool isElabNaked(KL(HeadKs,,K,,TailKs))
287288
andBool isElab(HeadKs) //Forces elaboration left-to-right. Required when KL == 'ListWrap of statements.
288289
[transition-strictness]
289290
291+
290292
/*@ Terms that should use custom elaboration rules. For those terms:
291293
- They will not be automatically heated from their parents into the elab() state.
292294
- They will not be automatically passed to elabDispose() state. Instead, those terms should have custom rules
@@ -324,6 +326,218 @@ rule isElabNaked(K:K) =>
324326
orBool (getKLabel(K) ==KLabel 'Id)
325327
orBool (getKLabel(K) ==KLabel 'Lit)
326328

329+
/*@ Java KLabels that are processed by default heating/cooling rules of elaboration.
330+
All KLabels that can be part of a code block during elaboration phase,
331+
except those members of customElabChildren or isElabNaked groups.
332+
*/
333+
syntax K ::= "defaultElabChildren" "(" KLabel ")" [function]
334+
rule defaultElabChildren(KL:KLabel) =>
335+
(KL ==KLabel 'ListWrap)
336+
orBool (KL ==KLabel 'Some)
337+
orBool (KL ==KLabel 'None)
338+
/*orBool (KL ==KLabel 'Single)
339+
orBool (KL ==KLabel 'NamedEscape)
340+
orBool (KL ==KLabel 'OctaEscape1)
341+
orBool (KL ==KLabel 'OctaEscape2)
342+
orBool (KL ==KLabel 'OctaEscape3)
343+
orBool (KL ==KLabel 'UnicodeEscape)
344+
orBool (KL ==KLabel 'String)
345+
orBool (KL ==KLabel 'Chars)*/
346+
347+
orBool (KL ==KLabel 'Assign)
348+
orBool (KL ==KLabel 'AssignMul)
349+
orBool (KL ==KLabel 'AssignDiv)
350+
orBool (KL ==KLabel 'AssignRemain)
351+
orBool (KL ==KLabel 'AssignPlus)
352+
orBool (KL ==KLabel 'AssignMinus)
353+
orBool (KL ==KLabel 'AssignLeftShift)
354+
orBool (KL ==KLabel 'AssignRightShift)
355+
orBool (KL ==KLabel 'AssignURightShift)
356+
orBool (KL ==KLabel 'AssignAnd)
357+
orBool (KL ==KLabel 'AssignExcOr)
358+
orBool (KL ==KLabel 'AssignOr)
359+
orBool (KL ==KLabel 'InstanceOf)
360+
orBool (KL ==KLabel 'Mul)
361+
orBool (KL ==KLabel 'Div)
362+
orBool (KL ==KLabel 'Remain)
363+
orBool (KL ==KLabel 'Plus)
364+
orBool (KL ==KLabel 'Minus)
365+
orBool (KL ==KLabel 'LeftShift)
366+
orBool (KL ==KLabel 'RightShift)
367+
orBool (KL ==KLabel 'URightShift)
368+
orBool (KL ==KLabel 'Lt)
369+
orBool (KL ==KLabel 'Gt)
370+
orBool (KL ==KLabel 'LtEq)
371+
orBool (KL ==KLabel 'GtEq)
372+
orBool (KL ==KLabel 'Eq)
373+
orBool (KL ==KLabel 'NotEq)
374+
orBool (KL ==KLabel 'LazyAnd)
375+
orBool (KL ==KLabel 'LazyOr)
376+
orBool (KL ==KLabel 'And)
377+
orBool (KL ==KLabel 'ExcOr)
378+
orBool (KL ==KLabel 'Or)
379+
orBool (KL ==KLabel 'Cond)
380+
orBool (KL ==KLabel 'PreIncr)
381+
orBool (KL ==KLabel 'PreDecr)
382+
orBool (KL ==KLabel 'Complement)
383+
orBool (KL ==KLabel 'Not)
384+
orBool (KL ==KLabel 'CastPrim)
385+
orBool (KL ==KLabel 'CastRef)
386+
orBool (KL ==KLabel 'PostIncr)
387+
orBool (KL ==KLabel 'PostDecr)
388+
orBool (KL ==KLabel 'Invoke)
389+
orBool (KL ==KLabel 'Method)
390+
orBool (KL ==KLabel 'SuperMethod)
391+
orBool (KL ==KLabel 'QSuperMethod)
392+
orBool (KL ==KLabel 'GenericMethod)
393+
orBool (KL ==KLabel 'ArrayAccess)
394+
orBool (KL ==KLabel 'Field)
395+
orBool (KL ==KLabel 'SuperField)
396+
orBool (KL ==KLabel 'QSuperField)
397+
orBool (KL ==KLabel 'NewArray)
398+
// orBool (KL ==KLabel 'UnboundWld)
399+
orBool (KL ==KLabel 'Dim)
400+
// orBool (KL ==KLabel 'NewInstance)
401+
// orBool (KL ==KLabel 'QNewInstance)
402+
// orBool (KL ==KLabel 'Lit)
403+
// orBool (KL ==KLabel 'Class)
404+
/* orBool (KL ==KLabel 'VoidClass)*/
405+
orBool (KL ==KLabel 'This)
406+
orBool (KL ==KLabel 'QThis)
407+
/*orBool (KL ==KLabel 'PackageDec)
408+
orBool (KL ==KLabel 'TypeImportDec)
409+
orBool (KL ==KLabel 'TypeImportOnDemandDec) //ok
410+
orBool (KL ==KLabel 'StaticImportDec)
411+
orBool (KL ==KLabel 'StaticImportOnDemandDec)
412+
orBool (KL ==KLabel 'AnnoDec)
413+
orBool (KL ==KLabel 'AnnoDecHead)
414+
orBool (KL ==KLabel 'AnnoMethodDec)
415+
orBool (KL ==KLabel 'Semicolon)
416+
orBool (KL ==KLabel 'DefaultVal)
417+
orBool (KL ==KLabel 'AbstractMethodDec)
418+
orBool (KL ==KLabel 'DeprAbstractMethodDec)
419+
orBool (KL ==KLabel 'ConstantDec)
420+
orBool (KL ==KLabel 'InterfaceDec)
421+
orBool (KL ==KLabel 'InterfaceDecHead)
422+
orBool (KL ==KLabel 'ExtendsInterfaces)
423+
orBool (KL ==KLabel 'EnumDec)
424+
orBool (KL ==KLabel 'EnumDecHead)
425+
orBool (KL ==KLabel 'EnumBody)
426+
orBool (KL ==KLabel 'EnumConst)
427+
orBool (KL ==KLabel 'EnumBodyDecs)*/
428+
/*orBool (KL ==KLabel 'ConstrDec)
429+
orBool (KL ==KLabel 'ConstrDecHead)
430+
orBool (KL ==KLabel 'ConstrBody)*/
431+
// orBool (KL ==KLabel 'AltConstrInv)
432+
// orBool (KL ==KLabel 'SuperConstrInv)
433+
// orBool (KL ==KLabel 'QSuperConstrInv)
434+
/*orBool (KL ==KLabel 'StaticInit)
435+
orBool (KL ==KLabel 'InstanceInit)*/
436+
orBool (KL ==KLabel 'Empty)
437+
orBool (KL ==KLabel 'Labeled)
438+
orBool (KL ==KLabel 'ExprStm)
439+
orBool (KL ==KLabel 'If)
440+
orBool (KL ==KLabel 'AssertStm)
441+
orBool (KL ==KLabel 'Switch)
442+
orBool (KL ==KLabel 'SwitchBlock)
443+
orBool (KL ==KLabel 'SwitchGroup)
444+
orBool (KL ==KLabel 'Case)
445+
orBool (KL ==KLabel 'Default) //default keyword from switch
446+
orBool (KL ==KLabel 'While)
447+
orBool (KL ==KLabel 'DoWhile)
448+
// orBool (KL ==KLabel 'For)
449+
// orBool (KL ==KLabel 'ForEach)
450+
orBool (KL ==KLabel 'Break)
451+
orBool (KL ==KLabel 'Continue)
452+
orBool (KL ==KLabel 'Return)
453+
orBool (KL ==KLabel 'Throw)
454+
orBool (KL ==KLabel 'Synchronized)
455+
orBool (KL ==KLabel 'Try)
456+
// orBool (KL ==KLabel 'Catch)
457+
// orBool (KL ==KLabel 'LocalVarDecStm)
458+
// orBool (KL ==KLabel 'LocalVarDec)
459+
// orBool (KL ==KLabel 'Block)
460+
// orBool (KL ==KLabel 'ClassDecStm)
461+
/*orBool (KL ==KLabel 'MethodDec)
462+
orBool (KL ==KLabel 'MethodDecHead)
463+
orBool (KL ==KLabel 'DeprMethodDecHead)
464+
orBool (KL ==KLabel 'Void)
465+
orBool (KL ==KLabel 'Param)
466+
orBool (KL ==KLabel 'VarArityParam)
467+
orBool (KL ==KLabel 'ThrowsDec) */
468+
orBool (KL ==KLabel 'NoMethodBody)
469+
orBool (KL ==KLabel 'ArrayInit)
470+
/*orBool (KL ==KLabel 'Anno)
471+
orBool (KL ==KLabel 'SingleElemAnno)
472+
orBool (KL ==KLabel 'MarkerAnno)
473+
orBool (KL ==KLabel 'ElemValPair)
474+
orBool (KL ==KLabel 'ElemValArrayInit)
475+
orBool (KL ==KLabel 'FieldDec)*/
476+
orBool (KL ==KLabel 'VarDec)
477+
orBool (KL ==KLabel 'ArrayVarDecId)
478+
/*orBool (KL ==KLabel 'ClassDec)
479+
orBool (KL ==KLabel 'ClassBody)
480+
orBool (KL ==KLabel 'ClassDecHead)
481+
orBool (KL ==KLabel 'SuperDec)
482+
orBool (KL ==KLabel 'ImplementsDec)
483+
orBool (KL ==KLabel 'CompilationUnit)
484+
orBool (KL ==KLabel 'PackageName)*/
485+
486+
orBool (KL ==KLabel 'AmbName)
487+
// orBool (KL ==KLabel 'TypeName)
488+
orBool (KL ==KLabel 'ExprName)
489+
490+
orBool auxLabelInElab(KL)
491+
orBool (KL ==KLabel 'MethodName)
492+
/*orBool (KL ==KLabel 'PackageOrTypeName)
493+
orBool (KL ==KLabel 'TypeArgs)
494+
orBool (KL ==KLabel 'TypeArgs)
495+
orBool (KL ==KLabel 'Wildcard)
496+
orBool (KL ==KLabel 'WildcardUpperBound)
497+
orBool (KL ==KLabel 'TypeParam)
498+
orBool (KL ==KLabel 'TypeBound)
499+
orBool (KL ==KLabel 'TypeParams)
500+
orBool (KL ==KLabel 'ClassOrInterfaceType)
501+
orBool (KL ==KLabel 'ClassType)
502+
orBool (KL ==KLabel 'InterfaceType
503+
orBool (KL ==KLabel 'Member)
504+
orBool (KL ==KLabel 'TypeVar)
505+
orBool (KL ==KLabel 'ArrayType)
506+
orBool (KL ==KLabel 'Boolean)
507+
orBool (KL ==KLabel 'Byte)
508+
orBool (KL ==KLabel 'Short)
509+
orBool (KL ==KLabel 'Int)
510+
orBool (KL ==KLabel 'Long)
511+
orBool (KL ==KLabel 'Char)
512+
orBool (KL ==KLabel 'Float)
513+
orBool (KL ==KLabel 'Double)
514+
orBool (KL ==KLabel 'Null)
515+
orBool (KL ==KLabel 'Bool)
516+
orBool (KL ==KLabel 'True)
517+
orBool (KL ==KLabel 'False)
518+
orBool (KL ==KLabel 'Deci)
519+
orBool (KL ==KLabel 'Hexa)
520+
orBool (KL ==KLabel 'Octa)
521+
orBool (KL ==KLabel 'Public)
522+
orBool (KL ==KLabel 'Private)
523+
orBool (KL ==KLabel 'Protected)
524+
orBool (KL ==KLabel 'Abstract)
525+
orBool (KL ==KLabel 'Final)
526+
orBool (KL ==KLabel 'Static)
527+
orBool (KL ==KLabel 'Native)
528+
orBool (KL ==KLabel 'Transient)
529+
orBool (KL ==KLabel 'Volatile)
530+
orBool (KL ==KLabel 'StrictFP)
531+
orBool (KL ==KLabel 'Id)*/
532+
533+
syntax K ::= auxLabelInElab( KLabel ) [function]
534+
rule auxLabelInElab(KL:KLabel) =>
535+
KL ==KLabel 'setEncloser`(_`,_`,_`)
536+
orBool KL ==KLabel 'noValue
537+
orBool KL ==KLabel 'noClass
538+
orBool KL ==KLabel 'stmtAndExp`(_`,_`)
539+
orBool KL ==KLabel 'toString`(_`)
540+
327541
//@ Will not match .K - is not isElabNaked. (.K) is matched by [elabDotK].
328542
rule [unwrapElabNaked]:
329543
elab(K:K) => K
@@ -357,9 +571,10 @@ syntax K ::= "elabDispose" "(" K ")"
357571
rule [elabDisposeStartDefault]:
358572
elab(KL:KLabel(ElabResL:KList)) => elabDispose(KL(ElabResL))
359573
when
360-
notBool customElabChildren(KL)
574+
defaultElabChildren(KL)
575+
// notBool customElabChildren(KL)
361576
andBool isElab(ElabResL)
362-
andBool notBool isElabNaked(KL(ElabResL))
577+
// andBool notBool isElabNaked(KL(ElabResL))
363578

364579
rule [elabDisposeProcess]:
365580
elabDispose(KL:KLabel(_,, (elabRes(K:K) => K),, _))

0 commit comments

Comments
 (0)