13.07.2015 Views

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

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.

An <strong>Object</strong> <strong>Oriented</strong> Language 10Table 1: rCos/g Syntaxprogram ::= cdecl • Mainprogramcdecl ::= class Cclass declaration[〈α cnstr〉]type parameters[extends Cc]direct superclass{adef ; mdef }memberscnstr ::=constraints[extends Cu]superclass constraint[implements Cn] member constraintadef ::= visib Te a attribute definitionvisib ::= private | protect | public visibilitymdef ::= m(Te x) {c} method definitionCu ::= Cc | αsuperclass upper boundTe ::=type expressionZ | B | Sprimitive types| CeCe ::= Cc | Cn | αclass expressionsCn ::= ⋓ Ccclass conjunctionCc ::= C | Cjconcrete classesCj ::= C〈α ↦→ Te〉class instantiationc ::=commandskip| var Te x variable declaration| end x variable undeclaration| Cc.new(le) object creation| le := e assignment| e.m(ve • x • re) method invocation| c; c | c ⊳ e ⊲ c | e ∗ c structural commandsve ::= evalue argumentre ::= leresult argumente ::=expressionle | self | null | l| (Ce)e type cast| f(e) built-in function appl.le ::=l-expressionx| e.a object attributeextv ::= Te xexternal variable decl.Main ::= {extv; c}main method definitionAn attribute definition adef consists of a visibility specification visib and an attribute typing.A method definition mdef is a method signature consisting of a method name and a <strong>for</strong>malparameter typing list, followed by a command as the method body.A type is specified by a type expression Te, which is either a primitive type or a class expression.Class expressions Ce are <strong>for</strong>med from classes, type variables, class conjunctions and class instantiations.Among class expressions, classes and class instantiations are called concrete classes,Report No. 448, June 2011UNU-IIST, P.O. Box 3058, Macao

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

Saved successfully!

Ooh no, something went wrong!