• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content


Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!




Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages. Alexandre Bergel, Christophe Dony, Stéphane Ducasse (ESUG 2004, Koethen)

Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages. Alexandre Bergel, Christophe Dony, Stéphane Ducasse (ESUG 2004, Koethen)



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Prototalk Prototalk Presentation Transcript

    • Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO Languages Alexandre Bergel, Christophe Dony, Stéphane Ducasse University of Bern (Switzerland) LIRMM, Montpellier (France) bergel@iam.unibe.ch 1
    • Outline 1. Prototype OO Languages 2. Expressing Different Languages 3. Prototalk 4. Example: Newtonscript 5. Conclusion 2
    • Prototype OO Languages • Classless paradigm • A prototype contains its state and behavior • Link between prototypes is usually done using: • Delegation • Composition 3
    • Different Languages • Self: Unification of variables and methods and multiple parents • ObjectLisp: variables distinct from methods • NewtonScript: two kinds of delegation over two links 4
    • Prototalk 5
    • Goal and Design Decisions • Uniformity: same syntax for all the languages • Minimality: minimal kernel to express the most general semantics • Extensibility: new languages has to be implemented efficiently and easily • Usability: integrated in the environment 6
    • Prototalk • Language represented by a subclass of AbstractProto • Execution of program by sending evaluate: to it • The AST is built using a ProgramNodeBuilder • It is composed of subclass of the Smalltalk AST nodes 7
    • Architecture Prototalk Base MethodNode selector AbstractObjectModel block eval: context evaluate: sourceCode applyWith: args in: context compileMethodAt: name NodeBuilder compile: codeSource ProgramNode globalVar: varName put: aValue newVariableName: name nodeBuilder eval: context newMessageReceiver: rcvr ... MessageNode VariableNode selector variableName eval: context eval: context Language1 Language1NodeBuilder Language1 variables MessageNode methods newVariableName: name methodOwner: name newMessageReceiver: eval: context clone ... ... Language1 VariableNode eval: context Implementation of Language1 8
    • Language1 • Language1 is a subclass of AbstractProto • Ability to execute programs • Prototypes are represented by its instances • Provides primitives like clone, addVar: addMethod:, hasVar:, ... 9
    • Example: NewtonScript _parent _proto • It has a double inheritance: _proto is searched prior to _parent 10
    • Double Inheritance f := {getX: funct() x, _proto: {_proto: {x: 10}}}; f._parent := {x: 20}; x: 20 f getX x: 10 _parent f.getX() ==> 10 11 _proto
    • In Prototalk f := {getX: funct() x, _proto: {_proto: {x: 10}}}; f._parent := {x: 20}; f.getX() ==> 10 The same program in Prototalk: NewtonScriptLike evaluate: ‘ f := PRoot clone. f proto: (PRoot clone; proto: (PRoot clone; addSlot: ‘‘x = 10’’)). f addSlot: ‘‘getX x’’. f parent: (PRoot clone; addSlot: ‘x = 20’). f getX.’ 12
    • In Prototalk t := self methodOwnerInProto: name. ^ t isNil AbstractProto ifTrue: [ parent isNil ifTrue: [nil] ifFalse: [parent methodOwner: name]] ifFalse: [t]] NewtonScriptLike parent proto ^ (slots includesKey: name) slots ifTrue: [self] methodOwner: name ifFalse: [ proto isNil methodOwnerInProto: name ifTrue: [nil] ifFalse: [proto methodOwnerInProto: name]] 13
    • Conclusion • Platform to design and experiment prototypes-based OO language • Pure interpretation of programs • Pedagogical tool: used at University Paris VI, Montpellier and Berne 14
    • • Prototalk: an Environment for Teaching, Understanding, Designing and Prototyping OO languages • bergel@iam.unibe.ch 15
    • 16
    • Hierarchy of Object Model AbstractProto newEmpty SlotProto slots clone addSlot: name ModifiableSlot method: code methodNamed: name L11 L7 initInitials: slots newInitials: slots L7AndImplicitDelegation L7AndExplicitDelegation L11AndImplicitDelegation parent parent initializeParent: parent clone close methodLookup: name parent son SelfLike addSlot: slot L16 assignmentMethod: code 17
    • ProgramNodeBuilder Smalltalk ProgramNodeBuilder ProgramNodeBuilder newCondition(cond, then, else) AbstractProto newLiteralValue(literal) newMessageReceiver(object) nodeBuilder newMethodSelector(methName) newVariable(varName) newAssignmentVariable(name) EncapsulationPNB ExplicitDelegationPNB ImplicitDelegationPNB newMessageReceiver: object newMessageReceiver: object SelfLikeAssignment newVariable: varName MethodBuilder newAssignmentVariable: name ImplicitDelegation SelfLikePNB ExplicitDelegationEncapsulationPNB EncapsulationPNB newVariable: varName newVariable: varName newMessageReceiver: object newAssignmentVariable: name newAssignmentVariable: name ObjectLispLikePNB Prototalk ProgramNodeBuilder newMessageReceiver: object 18
    • Self, ObjectLisp, ... Person Person age=26 age=26 name=Luc name=Luc eat=... eat(...) Student Student num=1234567 num=1234567 grade=2 grade=2 doExam=... doExam(...) 19