19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> ways in which fortresses are actually realized on particular platforms are beyond the scope of this specification.<br />

An implementor might choose to instantiate a fortress as a process, or as a persistent object database stored in a file<br />

system, with fortress operations being implemented as scripts that manipulate this database.<br />

We call the source code for a single software component a project. Typically, when a project written in other programming<br />

languages is compiled, each file in the project is separately compiled. To ship an application, these files are<br />

linked together to form an application or library. <strong>Fortress</strong> uses a different model: a project is compiled directly into a<br />

single component, which is installed in the compiling fortress.<br />

From the point of view of the compiler, all the source code for a project is contained in a single file. This approach simplifies<br />

the design, and gives a well-defined order for initialization of static elements of the component. However, this<br />

approach is unworkable for components of substantial size. <strong>The</strong>refore, the compiler can be instructed to concatenate<br />

several source files together before compiling, while maintaining the original source location information.<br />

After these components are compiled from source files, they can then be linked together to form larger components.<br />

22.2 Components<br />

Syntax:<br />

Component ::= component DottedId Import ∗ Export ∗ Decl ∗ end<br />

DottedId ::= Id ( . Id) ∗<br />

Import ::= import ImportFrom from DottedId<br />

| import AliasedDottedIds<br />

ImportFrom ::= * [except Names]<br />

| AliasedNames<br />

Names ::= Name<br />

| { NameList }<br />

Name ::= Id<br />

| opr Op<br />

NameList ::= Name ( , Name) ∗<br />

AliasedNames ::= AliasedName<br />

| { AliasedNameList }<br />

AliasedName ::= Id [as DottedId]<br />

| opr Op [as Op]<br />

| opr LeftEncloser RightEncloser [as LeftEncloser RightEncloser]<br />

AliasedNameList ::= AliasedName ( , AliasedName) ∗<br />

AliasedDottedIds ::= AliasedDottedId<br />

| { AliasedDottedIdList }<br />

AliasedDottedId ::= DottedId [as DottedId]<br />

AliasedDottedIdList ::= AliasedDottedId ( , AliasedDottedId) ∗<br />

Export ::= export DottedIds<br />

DottedIds ::= DottedId<br />

| { DottedIdList }<br />

DottedIdList ::= DottedId ( , DottedId) ∗<br />

In this specification, we will refer to components created by compiling a file as simple components, while components<br />

created by linking components together will be known as compound components.<br />

<strong>The</strong> source code of a simple component definition begins with the special reserved word component followed by<br />

a possibly qualified name (an identifier or a sequence of identifiers separated by periods with no intervening whitespace),<br />

followed by a sequence of import statements, and a sequence of export statements, and finally a sequence of<br />

declarations.<br />

163

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!