Download presentation
Presentation is loading. Please wait.
Published byAmira Morice Modified over 9 years ago
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 9 1.1. Extensible Annotations …... …
10
1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 10 1.2. 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 11 1.3. 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 12 2. 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 13 2.1. 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 14 2.2. 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 15 2.3. 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 16 3. 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 17 3.1. 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 18 3.2. Use of an Intermediate Format Parser Tools Printer Unicode LaTeX E-mail … LaTeX/Unicode converter E-mail/Unicode converter …/Unicode converter
19
1 December 2005 © THE UNIVERSITY OF WAIKATO TE WHARE WANANGA O WAIKATO 19 4. 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 20 4.1. 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 21 4.2. 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 22 5. 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 23 5.1. 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 24 5.2. 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.