New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Super-reference split #59

merged 12 commits into from Jan 15, 2015


None yet
1 participant
Copy link

mantkiew commented Jan 15, 2015

Decouple super and reference. This allows providing both in a clafer declaration:

cmd : Port -> Command

Also, inheritance from primitive types is not allowed anymore. Previously : integer was rewritten to -> integer; however, since now a reference can be provided independently, we cannot perform that rewrite. For example, rewriting x : integer -> string would either require ability to have two references or choosing one. Perhaps the rewrite could still be provided in cases when no reference is given but that would encourage keeping using the bad style. UPDATE: after the pull request, desugaring of : into -> for primitive types was added back and it is performed when safe (that is, there's no reference).

Major grammar changes:

Clafer. Clafer ::= Abstract GCard PosIdent Super Reference Card Init Elements ;

SuperEmpty. Super ::= ;
SuperSome. Super ::= ":" SetExp ;

ReferenceEmpty. Reference ::= ;
ReferenceSet. Reference ::= "->" SetExp ;
ReferenceBag. Reference ::= "->>" SetExp ;

InitConstant. InitHow ::= "=" ;
InitDefault. InitHow ::= ":=" ;

IR changes:

data IClafer 
 , _parentUID :: UID 
 , _super :: Maybe PExp
 , _reference :: Maybe IReference

data IReference
 = IReference
 { _isSet :: Bool
  , _ref :: PExp

The ISuper datatype has been removed.


The uniqueness constraint for set reference clafers is no longer created in desugarer. Instead, the Alloy and Choco generators produce the required output for bags and sets.

The default super clafer is no longer produced by desugarer. It is represented in IR by _super=Nothing. It is also missing from the desugared clafer output for simplicity des.cfr and the XML output.

Stats are computed differently, because super and ref are counted independently.

We can now implement redefinition.

@mantkiew mantkiew added this to the 0.3.8 milestone Jan 15, 2015

@mantkiew mantkiew self-assigned this Jan 15, 2015

@mantkiew mantkiew changed the title Super-ref split Super-reference split Jan 15, 2015

@mantkiew mantkiew modified the milestone: 0.3.8 Jan 15, 2015

mantkiew added a commit that referenced this pull request Jan 15, 2015

@mantkiew mantkiew merged commit 06bf30f into develop Jan 15, 2015

@mantkiew mantkiew deleted the super-ref-split branch Jan 15, 2015

@mantkiew mantkiew modified the milestones: 0.3.8, 0.4.0 Jan 15, 2015

@mantkiew mantkiew referenced this pull request Jan 27, 2015


Release 0.3.8 #60

@mantkiew mantkiew modified the milestones: 0.3.8, 0.4.0 Jan 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment