Use of Attribute Grammars to Construct XML translators Supervisor: Prof. John Hurst Presenter: Nishan Jayasinghe.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Lesson 6 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
Programming Languages Third Edition Chapter 6 Syntax.
Extensible Stylesheet Language for Transformations XSLT An introduction.
SPECIAL TOPIC XML. Introducing XML XML (eXtensible Markup Language) ◦A language used to create structured documents XML vs HTML ◦XML is designed to transport.
COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 13-1 COS 346 Day 24.
176 Formal Languages and Applications: We know that Pascal programming language is defined in terms of a CFG. All the other programming languages are context-free.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
Visual Web Information Extraction With Lixto Robert Baumgartner Sergio Flesca Georg Gottlob.
1/18 CS 693/793 Lecture 09 Special Topics in Domain Specific Languages CS 693/793-1C Spring 2004 Mo, We, Fr 10:10 – 11:00 CH 430.
Grammars Examples and Issues. Examples from Last Lecture a + b a b + a*bc* First draw a state diagram Then create a rule for each transition.
Automatic Data Ramon Lawrence University of Manitoba
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Markup Languages & XML - BY VISHAL KAMTAM VENKATESH.
MC 365 – Software Engineering Presented by: John Ristuccia Shawn Posts Ndi Sampson XSLT Introduction BCi.
Introduction to XML: Part I By Sandeep Jangity CS 157B, Section 2 Dr. Lee.
4/20/2017.
Compiler Design Nai-Wei Lin Department of Computer Science National Chung Cheng University.
PROGRAMMING LANGUAGES The Study of Programming Languages.
Pemrograman Berbasis WEB XML part 2 -Aurelio Rahmadian- Sumber: w3cschools.com.
15 November 2005Linking Outside the Box1 Cross referencing between XML documents Bob Stayton Sagehill Enterprises
Why XML ? Problems with HTML HTML design - HTML is intended for presentation of information as Web pages. - HTML contains a fixed set of markup tags. This.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
IT420: Database Management and Organization XML 21 April 2006 Adina Crăiniceanu
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Parser-Driven Games Tool programming © Allan C. Milne Abertay University v
HTML and Style. Session overview Leveling-off on the basic concepts of HTML and Styles Discuss Web authoring options.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
Compiler Phases: Source program Lexical analyzer Syntax analyzer Semantic analyzer Machine-independent code improvement Target code generation Machine-specific.
Lexical Analysis - An Introduction. The Front End The purpose of the front end is to deal with the input language Perform a membership test: code  source.
Lexical Analysis - An Introduction Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at.
Compiler course 1. Introduction. Outline Scope of the course Disciplines involved in it Abstract view for a compiler Front-end and back-end tasks Modules.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
Lesson 3 CDT301 – Compiler Theory, Spring 2011 Teacher: Linus Källberg.
Chapter 27 The World Wide Web and XML. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.27-2 Topics in this Chapter The Web and the Internet.
An Introduction to XML Sandeep Bhattaram
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Understanding How XML Works Ellen Pearlman Eileen Mullin Programming the.
Review: Compiler Phases: Source program Lexical analyzer Syntax analyzer Semantic analyzer Intermediate code generator Code optimizer Code generator Symbol.
Schematron Tim Bornholtz. Schema languages Many people turn to schema languages when they want to be sure that an XML instance follows certain rules –DTD.
XML Grammar and Parser for WSOL Kruti Patel, Vladimir Tosic, Bernard Pagurek Network Management & Artificial Intelligence Lab Department of Systems & Computer.
Towards the better software metrics tool motivation and the first experiences Gordana Rakić Zoran Budimac.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 1, 08/28/03 Prof. Roy Levow.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
IT Accessibility Committee XML as Content Management Presented by Michael B. Short May 11, 2006 Prepared by the NYS Forum IT Accessibility Committee
Object-Oriented Parsing and Transformation Kenneth Baclawski Northeastern University Scott A. DeLoach Air Force Institute of Technology Mieczyslaw Kokar.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
XML Notes taken from w3schools. What is XML? XML stands for EXtensible Markup Language. XML was designed to store and transport data. XML was designed.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
CH 15 XSL Transformations 1. Objective What is XSL? Overview of XSL transformations Understanding XSL templates Computing the value of a node with xsl:value-of.
 Problem Analysis  Coding  Debugging  Testing.
Extensible Markup Language (XML) Pat Morin COMP 2405.
Lecture 9 Symbol Table and Attributed Grammars
Compiler Design (40-414) Main Text Book:
Learning outcomes 2 Developing Code – Input Output Model
Chapter 1 Introduction.
Lexical and Syntax Analysis
Chapter 1 Introduction.
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Compiler Lecture 1 CS510.
Database Processing with XML
Front End vs Back End of a Compilers
Review: Compiler Phases:
Presentation transcript:

Use of Attribute Grammars to Construct XML translators Supervisor: Prof. John Hurst Presenter: Nishan Jayasinghe

Project Aim Project Aim Existing XML Translator XSLT Existing XML Translator XSLT Translator Writing Techniques Translator Writing Techniques The Translators & Difficulties Encountered The Translators & Difficulties Encountered What Was Learnt? What Was Learnt? Future Work and Conclusion Future Work and Conclusion Overview

Project Aim Can we translate XML using attribute grammars? Can we translate XML using attribute grammars? Is it simpler to translate XML with attribute grammars compared to existing solutions? Is it simpler to translate XML with attribute grammars compared to existing solutions? Is it possible to create a simpler specification language that represent attribute grammar computations? Is it possible to create a simpler specification language that represent attribute grammar computations?

Existing XML Translator Most popular method for translating XML is XSLT Most popular method for translating XML is XSLT XML document and specification are used by XSL processor to do the translation XML document and specification are used by XSL processor to do the translation AdvantagesDisadvantages Simple to update and maintain the XSLT specifications Simple to update and maintain the XSLT specifications Reuse specification using by including other specifications Reuse specification using by including other specifications XSLT s pecification syntax is complicated XSLT s pecification syntax is complicated

Translator Writing Techniques Subset of stages involved in constructing a compiler Subset of stages involved in constructing a compiler  Lexical Analysis  Syntax Analysis  Semantic Analysis Why use these techniques? Why use these techniques?  These techniques have been applied to other translator writing tasks  Development time and effort shorter

Lexical Analysis Break up input document into tokens Break up input document into tokens Using Regular Expression Using Regular Expression XML for Beginners XML for Beginners StartName : StartName : DATA :[A-Za-z]+ EndName : EndName :

Syntax Analysis Describes the document structure Describes the document structure Using Context Free Grammar Using Context Free Grammar<book> XML for Beginners XML for Beginners J. Smith J. Smith </book> book: startBook name author endBook. name: startName DATA endName. author: startAuthor DATA endAuthor.

Semantic Analysis Describes computations that should occur given a particular context Describes computations that should occur given a particular context Using Attribute Grammar Using Attribute Grammar XML for Beginners XML for Beginners Title: XML for Beginners  Using RULE: name ::= startName DATA endName COMPUTE name.output = Concatenate( “Title:”, DATA); END;

Input (XML document) Lexical AnalysisSyntax AnalysisSemantic Analysis Output (translated document) Document Processing

The Translators It is possible to translate XML documents It is possible to translate XML documents  Created two translators  XML to HTML  XML to TEX

Our HTML Translator Output XSLT Output

Our TEX Translator Output XSLT Output

Display On a web browser

Difficulties Encountered We found that the translators can not deal with the following XSLT features We found that the translators can not deal with the following XSLT features  White space characters outside the character data sections  Changing of document structure from input document  Length and complexity of Code

Code Size Example XSLT Counting Attribute Grammar ATTR depth: int INH; RULE: document ::= DocType article COMPUTE document.depth = 0; END; SYMBOL enumerate COMPUTE INH.depth = ADD(INCLUDING (enumerate.depth,document.depth), 1); END;

What Did We Learn? Writing Attribute Grammar translator is very time consuming compared with XSLT Writing Attribute Grammar translator is very time consuming compared with XSLT  Difficult to learn some concepts  The amount of code required for simple translator is not worth the effort But is possible to automatically generate (given the DTD) specifications using a simple algorithm for But is possible to automatically generate (given the DTD) specifications using a simple algorithm for  Lexical Analysis specification  Syntax Analysis specification

Algorithm for DTD to Lexical Specifications Lexical Tokens startBook : endBook : startName : endName : startAuthor : endAuthor : PCDATA : [A-Za-z]+

Algorithm for DTD to Syntax Specifications Context Free Grammar book : startBook name author endBook name : startName PCDATA endName author : startAuthor PCDATA endAuthor

Future Work Due to a lack of time we could not create a specification language that can be used instead of attribute grammars by users Due to a lack of time we could not create a specification language that can be used instead of attribute grammars by users Implement other XSLT functions such as sort Implement other XSLT functions such as sort Try extending the automatic generation of specifications to other types of document formats Try extending the automatic generation of specifications to other types of document formats

Conclusion We were able to translate XML documents using attribute grammars We were able to translate XML documents using attribute grammars We were able to reduce most of the time required for developing attribute grammar translator using automatically generated specifications We were able to reduce most of the time required for developing attribute grammar translator using automatically generated specifications It is clear at the moment XSLT is much simpler specification language from writing translations It is clear at the moment XSLT is much simpler specification language from writing translations