2004-03-30mbe/pa/olm 1 Integration of BETA with Eclipse eTX presentation Barcelona 2004 Peter Andersen Mads Brøgger Enevoldsen Ole Lehrmann Madsen.

Slides:



Advertisements
Similar presentations
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Advertisements

pa 1 Porting BETA to ROTOR ROTOR Projects Presentation Day, June by Peter Andersen.
Copyright © 2012 Pearson Education, Inc. Chapter 9 Delegates and Events.
CSCC69: Operating Systems
Goals Give you a feeling of what Eclipse is.
MC697 Object-Oriented Programming Using Java. In this class, we will cover: How the class will be structured Difference between object-oriented programming.
Inlining Java Native Calls at Runtime (CASCON 2005 – 4 th Workshop on Compiler Driven Performance) Levon Stepanian, Angela Demke Brown Computer Systems.
Software Practices Lab. -- The University of British Columbia 1 The JQuery Tool A Generic Query-Based Code browser for Eclipse Project leaders: Kris De.
ITEC200 – Week03 Inheritance and Class Hierarchies.
Java developer tools Emanuel Dohi Lars Larsson
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
20-Jun-15 Eclipse. Most slides from: 2 About IDEs An IDE is an Integrated Development Environment.
2005/09/19-21Peter Andersen 1 Porting BETA to ROTOR/sscli ROTOR Capstone Workshop, Sept by Peter Andersen.
JAOO 2002olm1 Early Experience with Language Interoperability Porting the BETA language to Java and.NET Peter Andersen Ole Lehrmann Madsen Center for Pervasive.
Introduction to Java Programming Language Junji Zhi University of Toronto 1.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
Marlene Galea.  The JDK (Java Development Kit)  An IDE (Integrated Development Environment) ◦ Different IDEs include:  JCreator  NetBeans  BlueJ.
+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
JCE A Java-based Commissioning Environment tool Hiroyuki Sako, JAEA Hiroshi Ikeda, Visible Information Center Inc. SAD Workshop.
220 FINAL TEST REVIEW SESSION Omar Abdelwahab. INHERITANCE AND POLYMORPHISM Suppose you have a class FunClass with public methods show, tell, and smile.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Rutgers University Excellence Campaign 2/20/2004 Java Native Interface Tutorial Xiaolin Li Rutgers.
Java Introduction to JNI Prepared by Humaira Siddiqui.
How Java becomes agile riding Rhino Xavier Casellato VP of engineering, Liligo.com.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
COP 3330 Notes 1/12. Today's topics Downloading Java and Eclipse Hello World Basic control structures Basic I/O Strings.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
SCIRun and SPA integration status Steven G. Parker Ayla Khan Oscar Barney.
Eclipse Eclipse An IDE is an Integrated Development Environment Different IDEs meet different needs – BlueJ, DrJava are designed as teaching.
Android JNI and JAR Library JNI Library 1. JNI *.c sources file must include jni header file jni.h #include 2. In Make file CFLAGS must add -I $(NDK_INC)/
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
Eclipse 24-Apr-17.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
CSC 142 B 1 CSC 142 Java objects: a first view [Reading: chapters 1 & 2]
Eclipse. An IDE is an Integrated Development Environment Different IDEs meet different needs BlueJ, DrJava are designed as teaching tools Emphasis is.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Slide Advanced Programming 2004, based on LY Stefanus's slides Native Methods.
M1G Introduction to Programming 2 5. Completing the program.
TAKE – A Derivation Rule Compiler for Java Jens Dietrich, Massey University Jochen Hiller, TopLogic Bastian Schenke, BTU Cottbus/REWERSE.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Interfaces Chapter 9. 9 Creating Interfaces An interface is a contract. Every class that implements the interface must provide the interface’s defined.
Page 1 – Autumn 2009Steffen Vissing Andersen SDJ I1, Autumn 2009 Agenda: Java API Documentation Code Documenting (in javadoc format) Debugging.
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
By: Cheryl Mok & Sarah Tan. Java is partially interpreted. 1. Programmer writes a program in textual form 2. Runs the compiler, which converts the textual.
Object Oriented Programming Criteria: P2 Date: 07/10/15 Name: Thomas Jazwinski.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Eclipse 27-Apr-17.
Java State Explorer by: Richard Sherman Stephanie Taylor.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 20 – C++ Subclasses and Inheritance.
Lecture 6:Interfaces and Abstract Classes Michael Hsu CSULA.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
More Sophisticated Behavior
Inheritance and Polymorphism
Interfaces Professor Evan Korth.
Interfaces.
Inheritance Cse 3rd year.
Presentation transcript:

mbe/pa/olm 1 Integration of BETA with Eclipse eTX presentation Barcelona 2004 Peter Andersen Mads Brøgger Enevoldsen Ole Lehrmann Madsen

mbe/pa/olm Powerful BETA IDE already available. - So why Eclipse? Eclipse is gaining more and more users Programmers use several languages  Easier if the same IDE With language interoperability then a multi language IDE is a must Use of existing infrastructure Multiple platforms Reuse of tools produced for other languages Easier to maintain

mbe/pa/olm Requirements Plug-ins for BETA should be implemented in BETA  To reuse code from BETA IDE  BETA programmers use BETA Eclipse plug-ins must be Java classes Interoperability between BETA and Java is necessary

mbe/pa/olm Example: Add indent strategy Implement class BetaAutoIndentStrategy inheriting from DefaultAutoIndentStrategy from the Eclipse library Existing BETA code exists for analysing BETA source line and returning indentation level Two different approaches:  Java Native Interface (JNI) interoperability  Compiling BETA to Java bytecodes in.class files DefaultAutoIndentStrategy BetaAutoIndentStrategy

mbe/pa/olm JNI based BETA plug-in (complex!) public class BetaAutoIndentStrategy extends DefaultAutoIndentStrategy {... value = indentLine(lineNo); } Java class: int indentLineCB(int lineNo) { return indentLine(lineNo); } CwrappedBETALibrary: JNIEXPORT int JNICALL Java_BetaAutoIndentStrategy_indentLine (JNIEnv *env, jobject obj, int lineNo) { indentLineCB(lineNo); } JNIIndentWrapper: (# indentLine: (# enter lineNo do... #) BETAIndentationLibrary: ? native int indentLine(int lineNo); System.loadLibrary("JniIndentWrapper") Java codeBETA codeC code

mbe/pa/olm JVM Based BETA Plugin Alternative: Compile existing BETA code to Java bytecode Write BetaAutoIndentStrategy in BETA, inheriting directly from Java DefaultAutoIndentStrategy Requires mapping of BETA language to JVM using dedicated BETA compiler

mbe/pa/olm BETA vs. Java Class and method unified in pattern General nesting of patterns, i.e. also of methods INNER instead of super Enter-Do-Exit semantics Genericity in the form of virtual patterns Multiple return values Active objects in the form of Coroutines No constructors No dynamic exceptions

mbe/pa/olm The mapping Generating bytecode for JVM corresponds to making a BETA source mapping into Java source code Challenges for the mapping:  Must be complete  Must be semantically correct  Must be “nice”, i.e. classes generated from BETA must be understandable for Java programmers.

mbe/pa/olm Naive mapping into Java. Calculator: (# set: (# enter V do V  R #); add: (# enter V do R+V  R exit R #); #); Class Calculator extends Object { int R; void set(int V) { R = V; }; int add(int V) { R = R + V; return R;} }

mbe/pa/olm Naive mapping into Java.. Calculator C = new Calculator(); int X; C.set(12); X = C.add(5); 12  C.set; 5  C.add  X

mbe/pa/olm Instances of add Calculator: (# … add: (# enter V do R+V  R exit R #); #); A: ^C.add; &C.add[]  A[]; 6  A  X More complex mapping needed Possible to create instances of pattern add Creation of an instance of C.add Execution of the C.add instance

mbe/pa/olm Class Calculator extends Object { int R; class add extends Object{ … } … } Inner class add Class Calculator extends Object { int R; class add extends Object{ int V; void Enter(int a) { V = a; } void Do() { R = R + V }; int Exit() { return R; } } … } Class Calculator extends Object { int R; class add extends Object{ int V; void Enter(int a) { V = a; } void Do() { R = R + V }; int Exit() { return R; } } int add(int V){ … } … } Class Calculator extends Object { int R; class add extends Object{ int V; void Enter(int a) { V = a; } void Do() { R = R + V }; int Exit() { return R; } } int add(int V){ add A = new add(); A.Enter(V); A.Do(); return A.Exit(); } … } Calculator: (# … add: (# enter V do R+V  R exit R #); #);

mbe/pa/olm Use of add as a class: A: ^C.add; &C.add[]  A[]; 5  A  X Calculator C = new Calculator() int X; Calculator.add A; A = C.new add(); A.Enter(5); A.Do() X = A.Exit();

mbe/pa/olm Use of add as a method 5  C.add  X Calculator C = new Calculator() int X; X = C.add(5);

mbe/pa/olm Not described here… Inner call mechanism – implemented by declaring new methods at each inheritance level Virtual classes – corresponding to generics (Java 1.5) – implemented with virtual instantiation methods and a lot of casting Coroutines and concurrency – implemented with threads Pattern variables: Classes and methods as first-class values – implemented with reflection Leave/restart out of nested method activations – implemented with exceptions Multiple return values – implemented with extra fields Use of external classes and interfaces Numerous minor details!

mbe/pa/olm JVM Based Structure BetaAutoIndentStrategy: DefaultAutoIndentStrategy (# do … lineNo -> indentLine -> value; #) BETA pattern: (# indentLine: (# enter lineNo do... #) BETAIndentationLibrary: Eclipse plug-in code now written directly in BETA

mbe/pa/olm Debugger Integration Existing BETA debugger hard to port to Eclipse Since we compile to JVM, perhaps use Eclipse JDT debugger for Java? Turns out to work!  After some pain… 

mbe/pa/olm Demo

mbe/pa/olm Evaluation Two approaches for Eclipse plug-in writing using non-Java language: 1. JNI: possible, but complex and error-prone 2. JVM: Elegant, but hard work to compile your language to JVM. Allows for JDT reuse. Problems with our JVM solution: JVM code is slow, we have not yet looked at optimizations BETA developers want to build native applications, but have to debug via JVM target.

mbe/pa/olm Contacts: Mads Brøgger Enevoldsen Peter Andersen Ole Lehrmann Madsen Download: Questions?