Presentation is loading. Please wait.

Presentation is loading. Please wait.

DEPARTMENT OF COMPUTER SCIENCE TARI ROROHIKO CZT Support For Z Extensions Tim Miller University of Liverpool, UK Leo Freitas University of York, UK Petra.

Similar presentations


Presentation on theme: "DEPARTMENT OF COMPUTER SCIENCE TARI ROROHIKO CZT Support For Z Extensions Tim Miller University of Liverpool, UK Leo Freitas University of York, UK Petra."— Presentation transcript:

1 DEPARTMENT OF COMPUTER SCIENCE TARI ROROHIKO CZT Support For Z Extensions Tim Miller University of Liverpool, UK Leo Freitas University of York, UK Petra Malik University of Waikato, New Zealand Mark Utting University of Waikato, New Zealand

2 DEPARTMENT OF COMPUTER SCIENCE TARI ROROHIKO Community Z Tools An Open Implementation of the ISO Z Standard

3 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 3 CZT Overview

4 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 4 CZT Extensions Standard Z Object Z TCOZ Circus Rules + object oriented + modularity + Timed CSP + CSP + refinement calculus ZPattern + Inference and Rewrite Rules + Proof Trees + Pattern for Matching and Unification

5 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 5 Overview Show Extensibility of:  XML Schema  Java AST  Parsing and Printing  Specification Manager  Other Tools

6 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 6 1. XML Schema  Extensible Annotations  Extensible AST  Extensible XML Schemas XML Schema is an XML based description language to define legal XML documents, in this case a Z annotated syntax tree (ZML)

7 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 7 An Example Z Specification InitBirthdayBook BirthdayBook’ known’  {}

8 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 8 An XML Z AST InitBirthdayBook BirthdayBook known

9 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Extensible Annotations …... …

10 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Extensible AST Example … … … … Para Z:AxParaZ:FreePara OZ:ClassPara Circus:ChannelPara List of Para

11 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Extensible XML Schemas Z.xsd OZ.xsd TCOZ.xsd Circus.xsd Rules.xsd + object oriented + modularity + Timed CSP + CSP + refinement calculus ZPat.xsd + Inference and Rewrite Rules + Proof Trees + Pattern for Matching and Unification import

12 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Java AST  Visitor design pattern  Support of different coding styles  Automatic generation of AST classes The Java AST is a representation of ZML in Java classes to allow processing and manipulation of trees using Java tools

13 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO CZT Visitor Design Pattern  Standard Visitor Design Pattern decouples the AST classes from the algorithms (typechecker, transformer, printer, etc.)  CZT Visitor also … allows the AST hierarchy to be extended allows visitors to exploit the AST inheritance hierarchy

14 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Different Coding Styles interface ZSect { // return all children Object[] getChildren(); // create a new ZSect // with the given children Term create(Object[] c); } // returns the name String getName(); // sets the name void setName(String s); // returns the list of // paragraphs List getPara(); abstract concrete

15 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Generation of AST Classes Z.xsd Circus.xsd net.sourceforge.czt.z.ast.ZSect net.sourceforge.czt.z.ast.AxPara net.sourceforge.czt.z.ast.NarrPara … (over 400 classes and interfaces) net.sourceforge.czt.circus.ast.ChannelPara … GnAST Code Generator

16 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Parsing and Printing  Templates for code sharing  Unicode as intermediate format Parsing tools used are JFlex (a scanner generator for Java) and Cup (a LALR parser generator for Java); Challenge: Multiple Markups

17 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Templates for Code Sharing Parser.xml XSLT script ZParser.cup OZParser.cup … ZParser.javaOZParser.java Cup …

18 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Use of an Intermediate Format Parser Tools Printer Unicode LaTeX … LaTeX/Unicode converter /Unicode converter …/Unicode converter

19 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Specification Manager  Type extensibility  Command extensibility The specification manager is an extensible repository used by tools like parser and typechecker to store and retrieve information about specifications.

20 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Type Extensibility Definition Table for “MySpec” AST for “MySpec” Operator Table for “MySpec” SpecificationManager Rule Table for “MySpec” Classes for “MyOZSpec”

21 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Command Extensibility Definition Table for “MySpec” AST for “MySpec” Operator Table for “MySpec” SpecificationManager Rule Table for “MySpec” Parse Compute Operator Table Source for “MySpec” Compute Definition Table Compute Rule Table

22 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Other Tools  Transformation to Standard Z  Multiple Visitors  Inheritance, Delegation CZT includes tools like typechecker, animator, transformer, etc. These can be extended by:

23 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Transformation to Standard Z AST of an Extension Standard Z AST Converter (usually a visitor) CZT Standard Z Tools

24 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO Multiple Visitors z.TypeChecker z.ParaCheckerz.ExprChecker … oz.TypeChecker oz.ParaCheckeroz.ExprChecker … Visitor 6 7 oz.OpExprChecker

25 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 25 Summary and Future Work Showed CZT Extensibility of:  XML Schemas  Java AST  Parsing and Printing  Specification Manager  Other Tools Current Extensions: Object Z, TCOZ, Circus, Z pattern and Rules

26 1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 26 The End


Download ppt "DEPARTMENT OF COMPUTER SCIENCE TARI ROROHIKO CZT Support For Z Extensions Tim Miller University of Liverpool, UK Leo Freitas University of York, UK Petra."

Similar presentations


Ads by Google