diff options
author | ronny | 1999-10-05 13:09:14 +0000 |
---|---|---|
committer | ronny | 1999-10-05 13:09:14 +0000 |
commit | db9e59813541e06caece64592854862bab9c0138 (patch) | |
tree | ae7cef5982a377261188aed09dc0f0cc95c50f8c /frontend/typeproperties.dcl | |
parent | Standard project directories initialized by cvs2svn. (diff) |
Initial import
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/typeproperties.dcl')
-rw-r--r-- | frontend/typeproperties.dcl | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/frontend/typeproperties.dcl b/frontend/typeproperties.dcl new file mode 100644 index 0000000..fc7677a --- /dev/null +++ b/frontend/typeproperties.dcl @@ -0,0 +1,55 @@ +definition module typeproperties + +import StdInt, StdClass + +import general + +:: TypeClassification + +EmptyTypeClassification :: TypeClassification + +:: SignClassification = + { sc_pos_vect :: !BITVECT + , sc_neg_vect :: !BITVECT + } + +:: PropClassification :== BITVECT + +TopSignClass :== { sc_pos_vect = bitnot 0, sc_neg_vect = bitnot 0 } +ArrowSignClass :== { sc_pos_vect = 2, sc_neg_vect = 1 } +PosSignClass :== { sc_pos_vect = bitnot 0, sc_neg_vect = 0 } + +:: Sign = + { pos_sign :: !Bool + , neg_sign :: !Bool + } + + +TopSign :== { pos_sign = True, neg_sign = True } +BottomSign :== { pos_sign = False, neg_sign = False } +PositiveSign :== { pos_sign = True, neg_sign = False } +NegativeSign :== { pos_sign = False, neg_sign = True } + +signClassToSign :: !SignClassification !Int -> Sign + +/* +IsPositive sign_class index :== sign_class.sc_pos_vect bitand (1 << index) <> 0 +IsNegative sign_class index :== sign_class.sc_neg_vect bitand (1 << index) <> 0 +*/ +instance <<< Sign + +:: TypeSign key = + { ts_cons_var_signs :: !key + , ts_type_sign :: !SignClassification + } + +:: TypeProp key = + { ts_cons_var_props :: !key + , ts_type_prop :: !PropClassification + } + +retrieveSignClassification :: ![SignClassification] !TypeClassification -> Optional (TypeSign [SignClassification]) +retrievePropClassification :: ![PropClassification] !TypeClassification -> Optional (TypeProp [PropClassification]) + +addSignClassification :: ![SignClassification] !SignClassification !TypeClassification -> !TypeClassification +addPropClassification :: ![PropClassification] !PropClassification !TypeClassification -> !TypeClassification |