100 likes | 283 Views
Z to SAL conversion. Hamouda Chantar Abbas Wali Yogesh Sharma Alfonso Sosa. Review. We are interested in translating ZML into SAL. What we need: Knowledge about XML and schemas. Knowledge about Visitor Pattern. CZT parser. XML and Schemas.
E N D
Z to SAL conversion HamoudaChantar AbbasWali Yogesh Sharma Alfonso Sosa
Review • We are interested in translating ZML into SAL. • What we need: • Knowledge about XML and schemas. • Knowledge about Visitor Pattern. • CZT parser.
XML and Schemas • XML is a markup language for structuring and exchanging data. • Its textual format allows it to be understandable by both computers and humans. • It is defined with DTDs or Schemas (newer). • It allows cross-platform communication (e.g. Web services).
Schema • It is a document for describing XML documents. • It is itself, an XML document. • The ZML from CZT project is defined with it. • More information on the wiki.
Example • Birthday Book Example: • http://nt-appn.comp.nus.edu.sg/fm/zml/birthdaybook(full).xml
Visitor Pattern • A behaviour design pattern • It helps us reuse code and add more functionality to the existing classes with out changing any of them • We can divide the operation into 2 stages • The set-up process & • The actual operation flow
The set-up • Make a Visitor hierarchy. • Make the Elements available for visiting. • The elements will have an accept (Visitor v) method • The visitors will handle the actual Elements.
Actual operation and flow • The actual flow will start by calling the visit method in the Visitors. • Polymorphism will resolve to the right kind of visitor. • The visitors will resolve to the right kind of Element (in Java, this can be done with function overloading). • More information on the wiki
CZT Parser • Uses a custom Visitor Pattern • Can read from XML and make the AST available to visit. • This will allow to generate SAL code.
What’s next? • Use the CZT library. • We are having problems with identifying how to parse the ZML documents. • Documentation is scarce. • We have not identified at what point our visitor should be invoked. • We need to define a subset of Z to translate (reviewing the current parser would be useful).