1 / 18

Interpreter for ZOOM-I

Interpreter for ZOOM-I. Andrew Deren Initial Presentation - SE690 5/30/03 http://www.adersoftware.com/se690/. What is ZOOM?. ZOOM is a set of tools and notation specifications used for development of large scale Object-Oriented systems. ZOOM stands for Z-based Object Oriented Modeling

clinec
Télécharger la présentation

Interpreter for ZOOM-I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Interpreter for ZOOM-I Andrew Deren Initial Presentation - SE690 5/30/03 http://www.adersoftware.com/se690/

  2. What is ZOOM? • ZOOM is a set of tools and notation specifications used for development of large scale Object-Oriented systems. • ZOOM stands for Z-based Object Oriented Modeling • The ZOOM Project is supervised by Dr. Jia

  3. Part of Zoom • There are 3 parts of ZOOM: • ZOOM-D – design notation • Formal notation to specify design models: object design models and user interface design. • ZOOM-S – specification notation • Formal notation to describe the use cases with formally specified preconditions and postconditions. • ZOOM-I – implementation language • Can be any object-oriented language: Java, C++, etc • Currently work is done on extending Java. • Language will be extended with zoom specific features, but parts of the software system can be developed in target language.

  4. What is Interpreter? • An interpreter is a program that accepts any program (the source program) expressed in a particular language (the source language), and runs that source program immediately. • The interpreter does not translate the source program into object code prior to execution.

  5. Why Write Interpreter? • Easier to test programs, no need to recompile. Can test fragments of code. • Changes to design of ZOOM language are easier to test in interpreter. • Some features of ZOOM might be hard to translate to java code directly. • Interpreters are much easier to implement than compilers.

  6. Programming Language Lifecycle Model Can be implemented as Interpreter to test language features

  7. Features different from Java • Enumerations • Const • Type definitions • Generics • Language support for Sets/Lists/Relations • Foreach statement

  8. Enumerations • enum States { AL, CA, IL, NY, MA}; • Better type-safety than int or String. Can only use valid values and is enforced by compiler at compile time.

  9. Const & Type definitions • const int PI = 3.141592653 • Nicer syntax for: static final int PI = 3.141592653 • typedef SmallInt = 0 .. 100 • typedef CourseSet = {Course}

  10. Generics • class Hashtable<Key, Value> • Provides type safety for collections and other types • No longer casts needed to cast back to object

  11. Sets/Lists • Build in support for list and set construction • list = [1 .. 10] // list with 10 elements 1 to 10 • list = [1, 2, 3, 4] • list = [int x: x > 0 & x < 5 @ x * 2] • Similar syntax for set creation, but uses { instead of [ • Build in operators for list and set operations: • Union, intersection, cardinality, membership tests, etc. • boolean inList = x in list;

  12. Foreach • New addition to the language • foreach (Type x in Expression) • Expression must result in typesafe iterator.

  13. Interpreter Features • Integrated into zoom IDE • Syntax highlight and other nice editor features • Run zoom code directly from IDE with statement step through, variable evaluation, etc.

  14. Interpreter Architecture • 1. Program text is fetched to ZOOM Parser which builds AST nodes. • 2. AST nodes are transformed into language elements (Statements, Expressions, etc) • 3. Type checker checks type validity of the program. • 4. Interpreter walks AST evaluating statements and expressions.

  15. Interpreter Architecture • Operates on AST elements (expressions, statements, etc) • Interpreter runtime system holds all data in objects derived from Val • Each Val type knows how to interact with other Val types and supports all operators that can be performed by that type int x = 3; // creates ValInt int y = 4; // created ValInt int z = x + y; // calls x.operator_plus(y)

  16. Status • Currently interpreter can be used in command line mode, or as swing application. • Most operators, expressions and statements are functional for primitive types, sets and lists, but no object-oriented features yet.

  17. References • David A. Watt & Deryck F. Brown. Programming Language Processors in Java. Prentice Hall, 2000. • Alfred V. Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers: Principles, Techniques and Tools. Addison-Wesley,1988. • Ravi Sethi. Programming Languages, Concepts & Constructs. Addison-Wesley, 1996 • Randy M. Kaplan. Constructing Language Processors for Little Languages. John Wiley & Sons, Inc., 1994

  18. Questions?

More Related