Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTERPRETING IMPERATIVE PROGRAMMING LAGUAGES IN EXTENSIBLE STYLESHEET LANGUAGE TRANSFORMATIONS (XSLT) Authors: Ruhsan Onder Assoc.

Similar presentations


Presentation on theme: "INTERPRETING IMPERATIVE PROGRAMMING LAGUAGES IN EXTENSIBLE STYLESHEET LANGUAGE TRANSFORMATIONS (XSLT) Authors: Ruhsan Onder Assoc."— Presentation transcript:

1 INTERPRETING IMPERATIVE PROGRAMMING LAGUAGES IN EXTENSIBLE STYLESHEET LANGUAGE TRANSFORMATIONS (XSLT) Authors: Ruhsan Onder (ruhsan.onder@emu.edu.tr) Assoc. Prof. Dr. Zeki Bayram (zeki.bayram@emu.edu.tr)

2 OUTLINE Overview of work done XML based basic imperative language XIM Interpreter for XIM in XSLT Possible application areas Demonstration of a simple XIM code in execution Related work (XML based languages and their interpreters) Conclusion and future work References

3 OVERVIEW OF WORK DONE XML based basic imperative language XIM XIM; An XML based simple imperative language with basic constructs Assignment Loop (while) Conditional (if) Basic Arithmetic/Logic Operations Syntax description of XIM in XML Schema Interpretation, using XSLT

4  Pseudo algorithm of a sample XIM program to compute 5! var fact ←1 var last ←5 begin while (last>1) do fact ←fact*last last ←last-1 end while end

5 XIM code to compute 5! 1 5 1 1

6  Graphical representation of execution process XIM source code (XML doc.) Initializer stylesheet for sequencing Initializer stylesheet for attaching next info. XIM source code with Seq. info applier XIM code with Seq. & next info applier Resulting XIM code after execution of an instruction Interpreter Stylesheet Step 1 Step 2 Step 3 loop

7 XIM code after the application of 1 st Initializer Stylesheet 1 5 1 1 1

8 XIM code after the application of 2 nd Initializer Stylesheet 1 5 1 1 1

9 The Applier Program Pseudo algorithm of the C#.NET applier program 1. result tree ← XML document formed by the application of the initializer stylesheets to the original XIM program 2. While (the instruction to execute in result tree is not the element) result tree ← result of applying the interpreter stylesheet to result tree End While 3. Display the contents of the element

10 Applier (cont.) Written in C#.NET DOM is utilized for the traversal To check whether the instruction to be executed is an statement

11 Implementation of the XSLT Interpreter A named template for each construct A recursive named template for artihmetic / logic operations Expressions; infix binary trees Evaluator template calls itself until it comes to a leaf node which is a numeric literal or a variable To keep the sequence of the instruction to be executed @seq, @next, @true_next, @false_next attributes A program counter (PC) is maintained by the interpreter

12  Pseudo algorithm of the interpreter Match the instruction whose @seq is equal to the number in PC Call the template which decides the type of instruction and calls the corresponding template The matched instruction node sent as a parameter to the corresponding templates Upon the return of the called template copy the main part of the XIM code P.S. Matching facility of XSLT & XPath queries utilized to  find the instruction to be executed  access the user defined variables in memory

13  Pseudo algorithm of the templates Assignment Template  Copy all the variables in memory except PC and the one to whom a new value to be assigned  Call template for evaluation of the expression to be assigned  Recreate the variable with its new assigned value  Recreate the PC with its new value as the @next of the current instruction

14  Template for Conditional (If) and Loop (While) Evaluate the condition  Copy all other elements in the memory other than PC unchanged If the condition is true Update PC as @true_next of the current instruction Else Update PC as @false_next of the current instruction P.S. The distinction between If and While made by the initializer stylesheet during the insertion of @next attributes

15 POSSIBLE APPLICATION AREAS Delivery of executable content over internet together with its executer With the combined initializers and the interpreter into a single styleseet to provide single-step execution This approach opens the way for the development of applications compatible with any browser. A standard XSLT processor implemented in every browser XIM can be improved to create a distributed computing web service application For use in special purpose computations requiring intensive CPU usage Upon the requests of the user through a GUI, constructed XIM prog. can be sent to the client by the server together with the interpreter

16 Scripting program running on web server Server Web Browser Client User request sent by the browser XIM code constructed according to the the user request + XSLT interpreter Requested operation and parameters from user Execution of incoming XIM code using the incoming interpreter Step 1: Step 2 : Step 3: Step 4: For a computation intensive application

17 Semantic Web is the name of a new emerging diversion of the current Web, but unlike the current version it aims to implement machine-readable- structured information oriented version of Web. Ideas of the interpreter can be developed to implement an XSLT inference engine for semantic web Through the reasoning of ontologies by XSLT, an XML decision tree can be created APPLICATION AREAS (contd.)

18 XIM code after the application of 2 nd Initializer Stylesheet 1 5 1 1 1

19 DEMONSTRATION Execution steps after the interpreter stylesheet is applied 1 5 6 after the 1 st application of the interpreter stylesheet 5 11 after the execution of the first assignment statement in the loop 5 4 1 after $last decremented and PC is updated as 1 to loop

20 Execution demo (cont.) 5 4 6 condition of is satisfied and PC gets value of @true_next 20 4 11 $fact = $fact * $last 20 3 1 $last is decremented and PC becomes 1 to loop

21 Execution demo (cont.) 120 1 $last is decremented and PC becomes 1 to loop 120 1 15 Sample program after the applier program terminates. Condition of evaluates to false and PC gets value of @false_next to terminate loop

22 RELATED WORK An XML based scripting language and its interpreter in C++ [Arciniegas 2001] X-VRML ; An XML based language for modeling virtual reality whose interpeter is developed in Java [Walczak, Cellary 2002] XPEN ; An XML based format for distributed online handwriting recognition. Processing of it via a programming languagage through DOM [Lenaghan, Malyan 2003] A lazy XML parser via the implementation of lazy XSL transformations [Schott, Noga 2003]

23 CONCLUSION AND FUTURE WORK Operational Semantics of a simple XML based imperative language (XIM) is i mplemented in XSLT Execution of code through iterative application of the interpreter to the code  Current work Improving the interpreter for single-application to proivde for the delivery of a XIM program over Internet according to a user’s requirements, together with its data and interpreter Future work Implementation of denotational semantics of XIM by translating XIM programs into lambda calculus and interpreting the lambda calculus code using XSLT (web service semantics) Future Research XSLT inference engine for semantic web

24  Improvement to the interpreter Execution at a single step without the applier program Initializers and interpreter are combined into a single stylesheet Via the use of temporary result-tee fragments (can be assigned to an XSLT variable) Stylesheet is declared in the source code using : Step by step execution is better for tracing

25 REFERENCES 1.w3c.org recommendations for XML, XML Schema, XSLT, XPath 2. F. A. Arciniegas. Creating C++ interpreters for XML extension languages. http://www.informit.com/articles/article.asp?p=23277, September 2001.http://www.informit.com/articles/article.asp?p=23277 3. K. Walczak and W. Cellary. X-VRML – XML based modeling of virtual reality. Proceedings of the 2002 symposium on applications and the internet (SAINT’02), pages 204–213, 2002. 4. K.P. Lenaghan and R.R. Malyan. XPEN: An XML based format for distributed online handwriting recognition.Proceedings of the seventh international conference on document analysis and recognition (ICDAR’03), pages 1270–1274, 2003. 5. S. Schott and M. L. Noga. Lazy XSL transformations. Proceedings of the 2003 ACM symposium on Document engineering, pages 9–18, 2003.

26 QUESTIONS ?


Download ppt "INTERPRETING IMPERATIVE PROGRAMMING LAGUAGES IN EXTENSIBLE STYLESHEET LANGUAGE TRANSFORMATIONS (XSLT) Authors: Ruhsan Onder Assoc."

Similar presentations


Ads by Google