192 Chapter 11 Packages, Libraries, and Components
11.2 Libraries
Libraries define virtual locations for packages and other compilation units.
A library declaration defines a library name and may associate it with a physical
location using a standard universal resource indicator. The library itself is not a
location, but rather is a name or alias for a location that is used to reference a
collection of compilation units. By using URIs, library locations may be local to
the machine or distributed throughout the network.
11.2.1 Library Definition
Libraries are defined in the same manner as other top-level constructs are. The
library keyword declares a libr ary name and the optional is clause provides a
value for the library:
library name [[ is string ]] end library name;
The string value provides a location for the library contents and takes the form of
a standard URI pointing to the base library. Some examples of library declarations
library design_lib end library design_lib;
library local is
end library local;
library rosetta.lang is
end library rosetta.lang;
The library design_lib defines a library that is known to exist, but whose loca-
tion is not known. The
local library defines a library on the local machine
located in:
Finally, rosetta.lang defines a remote library located on www.rosetta.com in
the directory:
Defining libraries in this manner allows distributed system definitions. This is
vital for large systems, where design teams are physically distributed over large
distances. Using URIs allows Rosetta to take advantage of standard location defi-
nition techniques and access methods.
11.2 Libraries 193
11.2.2 Referencing Library Elements
Library elements are referenced using the standard dot notation. For example:
use local.data_types;
Uses the package data_types located in the local library. If a package appears in
use clause without a library qualifier, the working package is assumed with the
current location used as the library. For example:
use data_types;
looks for a package named data_types in the current working directory. This is
the equivalent of the definition:
use working.data_types;
Here, working is not a library, but rather is the name of the package containing
11.2.3 Predefined Libraries
Several predefined libraries must exist for any Rosetta installation (Table 11.1).
rosetta.lang library provides basic language definition packages. The
prelude package contains the Rosetta prelude, defining all constructs defined
in the
static domain. If the null domain is extended with the prelude package,
static domain results. The unicode package defines characters and oper-
ators for standard Unicode manipulation. Finally, the
domains package contains
definitions for the base Rosetta domain set.
The rosetta.lang.reflect library provides reflection operators used to define
and manipulate Rosetta language constructs. The lexical and abstract_syntax
packages contain definitions for lexical constructs and data structures representing
abstract syntax, respectively. The semantics, simplification, and name_expansion
Table 11.1 Built-in Rosetta libraries and associated packages
Library Package Contents
rosetta.lang prelude Base language constructs
unicode Unicode definitions and functions
domains Base domain definitions
rosetta.lang.reflect lexical Lexical constructs
abstract_syntax Abstract syntax constructs
semantics Semantic definitions for abstract
syntax elements
simplification Derived form definitions
name_expansion Functions for expanding simple

Get System Level Design with Rosetta now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.