AS_Basic_CASL.der.hs revision 414029fc573cb2506241ed5a17643f9f721502b8
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian Maeder{-# LANGUAGE DeriveDataTypeable #-}
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederDescription : Abstract syntax of CASL basic specifications
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederCopyright : (c) Klaus Luettich, Christian Maeder, Uni Bremen 2002-2006
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederLicense : GPLv2 or higher, see LICENSE.txt
076b559b2ea7b2f1d303df992ae71cd6c6fe563cChristian MaederMaintainer : Christian.Maeder@dfki.de
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian MaederStability : provisional
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian MaederPortability : portable
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian MaederAbstract Syntax of CASL Basic_specs, Symb_items and Symb_map_items.
e8ffec0fa3d3061061bdc16e44247b9cf96b050fChristian Maeder Follows Sect. II:2.2 of the CASL Reference Manual.
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maederimport qualified Data.Set as Set
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder-- DrIFT command
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder{-! global: GetRange !-}
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maederdata BASIC_SPEC b s f = Basic_spec [Annoted (BASIC_ITEMS b s f)]
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder deriving (Show, Typeable, Data)
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maederdata BASIC_ITEMS b s f = Sig_items (SIG_ITEMS s f)
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder {- the Annotation following the keyword is dropped
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder but preceding the keyword is now an Annotation allowed -}
c18e9c3c6d5039618f1f2c05526ece84c7794ea3Christian Maeder | Free_datatype SortsKind [Annoted DATATYPE_DECL] Range
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- pos: free, type, semi colons
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder | Sort_gen [Annoted (SIG_ITEMS s f)] Range
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- pos: generated, opt. braces
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder | Var_items [VAR_DECL] Range
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- pos: var, semi colons
e05956d1da3c97e4d808926f97c6841c4a561991Christian Maeder | Local_var_axioms [VAR_DECL] [Annoted (FORMULA f)] Range
fe883661c9d1a5a8b42ac4e8673ec133d9dad354Christian Maeder -- pos: forall, semi colons, dots
c18e9c3c6d5039618f1f2c05526ece84c7794ea3Christian Maeder | Axiom_items [Annoted (FORMULA f)] Range
64558a09e6f6b95d2689d02dd5251339f8ac505bChristian Maeder | Ext_BASIC_ITEMS b
c18e9c3c6d5039618f1f2c05526ece84c7794ea3Christian Maeder deriving (Show, Typeable, Data)
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maederdata SortsKind = NonEmptySorts | PossiblyEmptySorts deriving (Show, Typeable, Data)
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maederdata SIG_ITEMS s f = Sort_items SortsKind [Annoted (SORT_ITEM f)] Range
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -- pos: sort, semi colons
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder | Op_items [Annoted (OP_ITEM f)] Range
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder -- pos: op, semi colons
40b9c4f89adc2853a26acdbd11ed760d4ba96cf0Christian Maeder | Pred_items [Annoted (PRED_ITEM f)] Range
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maeder -- pos: pred, semi colons
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder | Datatype_items SortsKind [Annoted DATATYPE_DECL] Range
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder -- type, semi colons
6e5180855658f12f9059d9041f447bf0935de344Christian Maeder | Ext_SIG_ITEMS s
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder deriving (Show, Typeable, Data)
c18e9c3c6d5039618f1f2c05526ece84c7794ea3Christian Maederdata SORT_ITEM f = Sort_decl [SORT] Range
64558a09e6f6b95d2689d02dd5251339f8ac505bChristian Maeder -- pos: commas
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maeder | Subsort_decl [SORT] SORT Range
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- pos: commas, <
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder | Subsort_defn SORT VAR SORT (Annoted (FORMULA f)) Range
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder {- pos: "=", "{", ":", ".", "}"
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder the left anno list stored in Annoted Formula is
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder parsed after the equal sign -}
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder | Iso_decl [SORT] Range
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder deriving (Show, Typeable, Data)
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maederdata OP_ITEM f = Op_decl [OP_NAME] OP_TYPE [OP_ATTR f] Range
8a1f427564a5ae2db32332512237ef645289c34dChristian Maeder -- pos: commas, colon, OP_ATTR sep. by commas
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder | Op_defn OP_NAME OP_HEAD (Annoted (TERM f)) Range
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder deriving (Show, Typeable, Data)
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maederdata OpKind = Total | Partial deriving (Show, Eq, Ord, Typeable, Data)
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maederdata OP_TYPE = Op_type OpKind [SORT] SORT Range
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder -- pos: "*"s, "->" ; if null [SORT] then Range = [] or pos: "?"
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder deriving (Show, Eq, Ord, Typeable, Data)
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederargs_OP_TYPE :: OP_TYPE -> [SORT]
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederargs_OP_TYPE (Op_type _ args _ _) = args
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederres_OP_TYPE :: OP_TYPE -> SORT
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederres_OP_TYPE (Op_type _ _ res _) = res
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederdata OP_HEAD = Op_head OpKind [VAR_DECL] (Maybe SORT) Range
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder -- pos: "(", semicolons, ")", colon
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder deriving (Show, Eq, Ord, Typeable, Data)
4be371b81d055e03a5946e4ec333613f313d689bChristian Maederdata OP_ATTR f = Assoc_op_attr | Comm_op_attr | Idem_op_attr
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder | Unit_op_attr (TERM f)
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder deriving (Show, Eq, Ord, Typeable, Data)
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maederdata PRED_ITEM f = Pred_decl [PRED_NAME] PRED_TYPE Range
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder -- pos: commas, colon
4be371b81d055e03a5946e4ec333613f313d689bChristian Maeder | Pred_defn PRED_NAME PRED_HEAD (Annoted (FORMULA f)) Range
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -- pos: "<=>"
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder deriving (Show, Typeable, Data)
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maederdata PRED_TYPE = Pred_type [SORT] Range
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder -- pos: if null [SORT] then "(",")" else "*"s
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder deriving (Show, Eq, Ord, Typeable, Data)
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maederdata PRED_HEAD = Pred_head [VAR_DECL] Range
568a1ce407fd05a2007c5db3c5c57098bf13997fChristian Maeder -- pos: "(",semi colons , ")"
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder deriving (Show, Typeable, Data)
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maederdata DATATYPE_DECL = Datatype_decl SORT [Annoted ALTERNATIVE] Range
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maeder -- pos: "::=", "|"s
2fc11b362b9242202bda207e7c7ecc7771f1a5e3Christian Maeder deriving (Show, Typeable, Data)
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maederdata ALTERNATIVE = Alt_construct OpKind OP_NAME [COMPONENTS] Range
7c57322afb6342e5cc8b1fdc96050b707407fc61Christian Maeder -- pos: "(", semi colons, ")" optional "?"
76fa667489c5e0868ac68de9f0253ac10f73d0b5Christian Maeder | Subsorts [SORT] Range
fd5d3885a092ac0727fa2436cdfc3b248318ebd8Christian Maeder -- pos: sort, commas
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maeder deriving (Show, Typeable, Data)
ac510075311023bf24175f7a76b89ec2bbda0626Christian Maederdata COMPONENTS = Cons_select OpKind [OP_NAME] SORT Range
{- Mixfix_ Term/Token/(..)/[..]/{..}
their identity w.r.t. the original signature. The newSort in a
the constraint (i.e. a "parameter sort"). Note that this representation of
-- | no duplicate sorts, i.e. injective sort map?
"CASL/AS_Basic_CASL: Internal error: Unqualified OP_SYMB in Sort_gen_ax"
fails (i.e. delivers Nothing) if the sort map is not injective -}
| Mixfix_term [TERM f] -- not starting with Mixfix_sorted_term/cast