Problem

I tried to define a relation that does an equality check on types, but allows wildcards by using an extra constructor Ign(). I tried to define a relation:

relations
  define <eq:

// relations
  
  /* TS rule, doesn't work because the # pattern isn't supported
  a <eq: b
  where a == b
     or a == Ign()
     or b == Ign()
     or a => c1#(l1)
     and b => c2#(l2)
     and c1 == c2
     and l1 <eq: l2
  */ // see equality.str for the stratego implementation

The # doesn’t work, so I wrote this in stratego. But that’s still a recursive relation so the analysis just loops:

        relation_create_match_0_1
	relation_create_match_0_3
	relation_create_match_0_4
	relation_match_custom_0_1
	relation_create_match_0_1
	relation_create_match_0_3
	relation_create_match_0_4
	relation_match_custom_0_1
	relation_create_match_0_1
	relation_create_match_0_3
	relation_create_match_0_4
	relation_match_custom_0_1

Question

Looks like this is not the way. So how would I do this? I think I need this Ign() in types, because I’m not just using type => Something(a,_) in TS, I’m also saying that the type of some things have holes:

FuncCall(e, "toEdge", e*)    : ItemTy(Edge(),Ign())
where ...
Submitted by Jeff Smits on 27 May 2015 at 00:26

Log in to post comments