19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Appendix A<br />

<strong>Fortress</strong> Calculi<br />

A.1 Basic Core <strong>Fortress</strong><br />

In this section, we define a basic core calculus for <strong>Fortress</strong>. We call this calculus Basic Core <strong>Fortress</strong>. Following the<br />

precedent set by prior core calculi such as Featherweight Generic Java [12], we have abided by the restriction that all<br />

valid Basic Core <strong>Fortress</strong> programs are valid <strong>Fortress</strong> programs.<br />

A.1.1<br />

Syntax<br />

A syntax for Basic Core <strong>Fortress</strong> is provided in Figure A.1. We use the following notational conventions:<br />

• For brevity, we omit separators such as , and ; from Basic Core <strong>Fortress</strong>.<br />

• −→ τ is a shorthand for a (possibly empty) sequence τ 1 , · · · , τ n .<br />

• Similarly, we abbreviate a sequence of relations α 1 extends N 1 , · · · , α n extends N n to −−−−−−−−−→ αextends N<br />

• We use τ i to denote the ith element of −→ τ .<br />

• For simplicity, we assume that every name (type variables, field names, and parameters) is different and every<br />

trait/object declaration declares unique name.<br />

• We prohibit cycles in type hierarchies.<br />

<strong>The</strong> syntax of Basic Core <strong>Fortress</strong> allows only a small subset of the <strong>Fortress</strong> language to be formalized. Basic Core<br />

<strong>Fortress</strong> includes trait and object definitions, method and field invocations, and self expressions. <strong>The</strong> types of<br />

Basic Core <strong>Fortress</strong> include type variables, instantiated traits, instantiated objects, and the distinguished trait Object.<br />

Note that we syntactically prohibit extending objects. Among other features, Basic Core <strong>Fortress</strong> does not include<br />

top-level variable and function definitions, overloading, excludes clauses, bounds clauses, where clauses, object<br />

expressions, and function expressions. Basic Core <strong>Fortress</strong> will be extended to formalize a larger set of <strong>Fortress</strong><br />

programs in the future.<br />

A.1.2<br />

Dynamic Semantics<br />

A dynamic semantics for Basic Core <strong>Fortress</strong> is provided in Figure A.2. This semantics has been mechanized via<br />

the PLT Redex tool [15]. It therefore follows the style of explicit evaluation contexts and redexes. <strong>The</strong> Basic Core<br />

313

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

Saved successfully!

Ooh no, something went wrong!