Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Designing an XML-based Exchange Format for Harmonia Marat Boshernitsan Susan L. Graham University of California, Berkeley, USA Exchange Formats Workshop.

Similar presentations


Presentation on theme: "1 Designing an XML-based Exchange Format for Harmonia Marat Boshernitsan Susan L. Graham University of California, Berkeley, USA Exchange Formats Workshop."— Presentation transcript:

1 1 Designing an XML-based Exchange Format for Harmonia Marat Boshernitsan Susan L. Graham University of California, Berkeley, USA Exchange Formats Workshop WCRE 2000, Brisbane, Australia

2 2 Application Domain Harmonia: a framework for constructing interactive language-based programming tools –Primary focus: front-end, user-visible tools (language- sensitive editors, source browsers, design assistants) –Simultaneously support many languages: C++, Java, as well as smaller domain-specific languages (make, bison, …) –Fine-grain version history: enables incremental analyses and other user services –Rapid prototyping: bindings for C++, C, Tcl, Java, Lisp –External tool integration: existing analyzers, source transformers, etc.

3 3 Exchange Format Requirements General requirements –Support for industry standards –Convenient APIs –Easy to generate, store, and parse Domain requirements –Small tools (individual source files) and large tools (entire software projects) –Harmonia-enabled tools as well as external language-sensitive tools –Legacy text-based tools (editors, compilers, etc.) –Support many languages – can not standardize on one encoding, e.g. JavaML use XML model internal program representation

4 4 Text: “if (cond) f();” AST… Example IfThenStmt if( VarRef ) ExprStmt Name cond MethodCall Name ( Args ) f to method declaration to variable declaration actually, ASG! ;

5 5 Encoding Graphs IfThenStmt if( VarRef ) ExprStmt Name cond MethodCall 1 Name 2 (4(4 Args 5 )6)6 f3f3 ; to method declaration: 42

6 6 Encoding Trees IfThenStmt if( VarRef ) ExprStmt Name cond MethodCall 1 Name 2 (4(4 Args 5 )6)6 f3f3 ; to method declaration: 42

7 7 Schemas XML documents should have a DTD  No type restrictions – cannot validate with respect to programming language  Need additional data schema

8 8 Idea: use the same typing mechanism as the AST  AST nodes typed according to the abstract grammar  Generate DTD from abstract grammar (used by the parser)  Interpret the DTD as a data schema Schemas (cont.) <!ATTLISTNameid ID#REQUIRED decl IDREF#REQUIRED>

9 9 Encoding Program Text Legacy tools may not want to understand XML: but it is not so easy to get to program text One last refinements: simply mark up the source… f ( ) Don’t want structure? Strip off XML tags (with XSL!):

10 10 Future Directions Schema and grammar evolution –Schema will change with the grammar Not really a problem: the grammar is abstract and rarely changes –Still, can use XSL to transform existing data to a new schema Harmonia-enabled editor can generate transformations automatically Incorporating version information –Need easy access to current version –Should be able to get to older versions Data granularity for high level modeling tools –Need incremental refinement of detail

11 11 Conclusions An encoding satisfying all design requirements –XML-based (standard, convenient APIs, easy import/export) –Works for variety of tools –Can utilize many off-the-shelf XML tools/libraries –Programming language independent (DTD generated from language grammar) More information –Harmonia web page: http://www.cs.berkeley.edu/Research/Projects/harmonia –Email: Marat Boshernitsan


Download ppt "1 Designing an XML-based Exchange Format for Harmonia Marat Boshernitsan Susan L. Graham University of California, Berkeley, USA Exchange Formats Workshop."

Similar presentations


Ads by Google