


## module-level-declarations.api
# Compiled by:
# src/lib/compiler/front/typer-stuff/typecheckdata.sublib# Datastructures describing module-level declarations.
#
# In particular, the datatypes
#
# Api,
# Package,
# Generic,
# Generic_Api,
#
# provide the value types bound by the symbol table
# for those four namespaces -- see OVERVIEW section in
#
# src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg#
#
#
# NB:, the 'Stampmapstack' type defined in
#
# src/lib/compiler/front/typer-stuff/modules/stampmapstack.pkg#
# is a low-maintenance alternative to the the 'Modtree'
# type we define here. See comments in above file for more info.
stipulate
package id = inlining_data; # inlining_data is from src/lib/compiler/front/typer-stuff/basics/inlining-data.pkg package ip = inverse_path; # inverse_path is from src/lib/compiler/front/typer-stuff/basics/symbol-path.pkg package mp = stamppath; # stamppath is from src/lib/compiler/front/typer-stuff/modules/stamppath.pkg package pl = property_list; # property_list is from src/lib/src/property-list.pkg package sp = symbol_path; # symbol_path is from src/lib/compiler/front/typer-stuff/basics/symbol-path.pkg package sta = stamp; # stamp is from src/lib/compiler/front/typer-stuff/basics/stamp.pkg package sy = symbol; # symbol is from src/lib/compiler/front/basics/map/symbol.pkg package ty = types; # types is from src/lib/compiler/front/typer-stuff/types/types.pkg package vh = varhome; # varhome is from src/lib/compiler/front/typer-stuff/basics/varhome.pkgherein
# This api is implemented in:
#
# src/lib/compiler/front/typer-stuff/modules/module-level-declarations.pkg #
api Module_Level_Declarations {
#
Share_Spec
=
List( sp::Symbol_Path );
Api = API Api_Record
| ERRONEOUS_API
also
Api_Element
#
= TYP_IN_API
{
module_stamp: sta::Stamp,
typ: ty::Typ,
is_a_replica: Bool,
scope: Int
}
#
| PACKAGE_IN_API
{
module_stamp: sta::Stamp,
an_api: Api,
definition: Null_Or( (Package_Definition, Int) ),
slot: Int
}
#
| GENERIC_IN_API
{
module_stamp: sta::Stamp,
a_generic_api: Generic_Api,
slot: Int
}
#
| VALUE_IN_API
{
type: ty::Type,
slot: Int
}
#
| VALCON_IN_API
{
datatype: ty::Valcon,
slot: Null_Or( Int )
}
also
Generic_Api
#
= GENERIC_API
{
kind: Null_Or( sy::Symbol ),
parameter_api: Api,
parameter_variable: sta::Stamp,
parameter_symbol: Null_Or( sy::Symbol ),
body_api: Api
}
#
| ERRONEOUS_GENERIC_API
also
External_Definition
#
= EXTERNAL_DEFINITION_OF_PACKAGE (sp::Symbol_Path, Package_Definition)
#
| EXTERNAL_DEFINITION_OF_TYP
{
extdef_path: sp::Symbol_Path, # The (inward) path to the spec being defined
extdef_typ: ty::Typ, # The definition, typically relativized.
extdef_is_relative: Bool # Does typ contain typechecked_package paths?
}
also
Package_Definition
#
= CONSTANT_PACKAGE_DEFINITION Package # Constant
| VARIABLE_PACKAGE_DEFINITION (Api, mp::Stamppath) # relative
# ------------------------- packages and generics ----------------------
also
Package
#
= A_PACKAGE Package_Record
#
| ERRONEOUS_PACKAGE
#
| PACKAGE_API
{
an_api: Api,
stamppath: mp::Stamppath
}
also
Generic
#
= GENERIC Generic_Record
| ERRONEOUS_GENERIC
# ----------------------- macroExpansion-related definitions --------------------
also
Typerstore_Entry # Elements of a Typerstore:
#
= TYP_ENTRY Typechecked_Typ
| PACKAGE_ENTRY Typechecked_Package
| GENERIC_ENTRY Typechecked_Generic
| ERRONEOUS_ENTRY
# We have no typechecked versions yet for
# values, constructors or exceptions,
# but this may change.
also
Generic_Closure # Application of a generic
#
= GENERIC_CLOSURE {
parameter_module_stamp: sta::Stamp,
body_package_expression: Package_Expression,
typerstore: Typerstore
}
also
Stamp_Expression
#
= MAKE_STAMP # Generate a new stamp.
| GET_STAMP Package_Expression
# | CONST sta::Stamp # An existing stamp
also
Typechecked_Typ_Expression # Expression evaluating to a type constructor typechecked_package:
#
= TYPE_VARIABLE_TYP mp::Stamppath # Selection from current Typerstore
| CONSTANT_TYP ty::Typ # Actual typ
| FORMAL_TYP ty::Typ # Formal typ
also
Package_Expression
#
= VARIABLE_PACKAGE mp::Stamppath
| CONSTANT_PACKAGE Typechecked_Package
| PACKAGE { stamp: Stamp_Expression, module_declaration: Module_Declaration }
| APPLY (Generic_Expression, Package_Expression)
| ABSTRACT_PACKAGE (Api, Package_Expression)
| FORMAL_PACKAGE Generic_Api
#
| PACKAGE_LET { declaration: Module_Declaration,
expression: Package_Expression
}
#
| COERCED_PACKAGE { boundvar: sta::Stamp,
raw: Package_Expression,
coercion: Package_Expression
}
# COERCED_PACKAGE is similar to
# PACKAGE_LET (m::PACKAGE_DECLARATION (boundvar, raw), coercion),
# but with special treatment of inverse_path propagation to support
# accurate type names in generic results where the generic has
# a result api constraint.
also
Generic_Expression
#
= VARIABLE_GENERIC mp::Stamppath
| CONSTANT_GENERIC Typechecked_Generic
| LAMBDA { parameter: sta::Stamp, body: Package_Expression }
| LAMBDA_TP { parameter: sta::Stamp, body: Package_Expression, an_api: Generic_Api }
| LET_GENERIC (Module_Declaration, Generic_Expression)
also
Module_Expression
#
= TYP_EXPRESSION Typechecked_Typ_Expression
| PACKAGE_EXPRESSION Package_Expression
| GENERIC_EXPRESSION Generic_Expression
| DUMMY_GENERIC_EVALUATION_EXPRESSION
| ERRONEOUS_ENTRY_EXPRESSION
also
Module_Declaration
#
= TYP_DECLARATION (sta::Stamp, Typechecked_Typ_Expression)
| PACKAGE_DECLARATION (sta::Stamp, Package_Expression, sy::Symbol)
| GENERIC_DECLARATION (sta::Stamp, Generic_Expression)
| SEQUENTIAL_DECLARATIONS List( Module_Declaration )
| LOCAL_DECLARATION (Module_Declaration, Module_Declaration)
| ERRONEOUS_ENTRY_DECLARATION
| EMPTY_GENERIC_EVALUATION_DECLARATION
also
Typerstore
#
= MARKED_TYPERSTORE Typerstore_Record
| NAMED_TYPERSTORE (mp::module_stamp_map::Map( Typerstore_Entry ), Typerstore)
| NULL_TYPERSTORE
| ERRONEOUS_ENTRY_DICTIONARY
also
Modtree # "modtree" == "module tree"
#
= PLAIN_TYP_MODTREE_NODE ty::Plain_Typ_Record
| API_MODTREE_NODE Api_Record
| PACKAGE_MODTREE_NODE Package_Record
| GENERIC_MODTREE_NODE Generic_Record
| TYPERSTORE_MODTREE_NODE Typerstore_Record
| MODTREE_BRANCH List( Modtree )
withtype
Stub_Info
=
{ owner: picklehash::Picklehash,
is_lib: Bool,
modtree: Modtree
}
also
Api_Record
=
{ stamp: sta::Stamp,
name: Null_Or( sy::Symbol ),
closed: Bool,
#
symbols: List( sy::Symbol ),
api_elements: List( (sy::Symbol, Api_Element)),
property_list: pl::Property_List,
#
contains_generic: Bool,
type_sharing: List( Share_Spec ),
package_sharing: List( Share_Spec ),
stub: Null_Or( Stub_Info )
}
also
Typerstore_Record
=
{ stamp: sta::Stamp,
typerstore: Typerstore,
stub: Null_Or( Stub_Info )
}
also
Typechecked_Package
=
{ stamp: sta::Stamp,
typerstore: Typerstore,
property_list: pl::Property_List,
inverse_path: ip::Inverse_Path,
stub: Null_Or( Stub_Info )
}
also
Package_Record
=
{ an_api: Api,
typechecked_package: Typechecked_Package,
varhome: vh::Varhome,
inlining_data: id::Inlining_Data
}
also
Typechecked_Generic
=
{ stamp: sta::Stamp,
generic_closure: Generic_Closure,
property_list: pl::Property_List,
typ_path: Null_Or( ty::Typ_Path ),
inverse_path: ip::Inverse_Path,
stub: Null_Or( Stub_Info )
}
also
Generic_Record
=
{ a_generic_api: Generic_Api,
typechecked_generic: Typechecked_Generic,
varhome: vh::Varhome,
inlining_data: id::Inlining_Data
}
also
Typechecked_Typ # The stamp and arith inside ty::Typ are critical:
=
ty::Typ;
Api_Elements
=
List( (sy::Symbol, Api_Element) );
# also constraint
# = { my_path: sp::Symbol_Path, its_ancestor: instrep, its_path: sp::Symbol_Path }
bogus_typechecked_package: Typechecked_Package;
bogus_typechecked_generic: Typechecked_Generic;
}; # Api Module
end; # stipulate
## (C) 2001 Lucent Technologies, Bell Labs
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


