Attribute Grammars and XML Workshop on Attribute Grammars, XML, and RDF Institute for Media and Communications Management University of St. Gallen 20/21.

Slides:



Advertisements
Similar presentations
CSCI N241: Fundamentals of Web Design Copyright ©2004 Department of Computer & Information Science Introducing XHTML: Module B: HTML to XHTML.
Advertisements

Chapter 2-2 A Simple One-Pass Compiler
© De Montfort University, XML – a meta language Howell Istance and Peter Norris School of Computing De Montfort University.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
PZ03CX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03CX - Language semantics Programming Language Design.
Slide 1 Chapter 3 Attribute Grammars. Slide 2 Attribute Grammars Certain language structures cannot be described using EBNF. Attribute grammars are extensions.
F DIGITAL MEDIA: COMMUNICATION AND DESIGN INTRODUCTION TO XML AND XHTML.
CS 898N – Advanced World Wide Web Technologies Lecture 22: Applying XML Chin-Chih Chang
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Compilers and Syntax.
XML(EXtensible Markup Language). XML XML stands for EXtensible Markup Language. XML is a markup language much like HTML. XML was designed to describe.
Introduction to XML Extensible Markup Language
Sebastian Bitzer Seminar Semistructured Data University of Osnabrueck May 2, 2003 XML An introduction in relation to semistructured.
Syntax & Semantic Introduction Organization of Language Description Abstract Syntax Formal Syntax The Way of Writing Grammars Formal Semantic.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 XML Taken from Chapter 7.
XML Anisha K J Jerrin Thomas. Outline  Introduction  Structure of an XML Page  Well-formed & Valid XML Documents  DTD – Elements, Attributes, Entities.
22-Sep-06 CS6795 Semantic Web Techniques 0 Horn Logic Markup Languages.
Lecture 16 Oct 18 Context-Free Languages (CFL) - basic definitions Examples.
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.
Lecture 6 of Advanced Databases XML Schema, Querying & Transformation Instructor: Mr.Ahmed Al Astal.
XML CPSC 315 – Programming Studio Fall 2008 Project 3, Lecture 1.
Extensible Markup and Beyond
XML - DTD. The building blocks of XML documents Elements, Tags, Attributes, Entities, PCDATA, and CDATA.
1 herbert van de sompel CS 502 Computing Methods for Digital Libraries Cornell University – Computer Science Herbert Van de Sompel
Introduction to XML. What is XML? Extensible Markup Language XML Easier-to-use subset of SGML (Standard Generalized Markup Language) XML is a.
Introduction to GAIGS XML Scripting Integrating Algorithm Visualization into Computer Science Education Grand Valley State University June 13-16, 2006.
Introduction to XML Extensible Markup Language. What is XML XML stands for eXtensible Markup Language. A markup language is used to provide information.
1 Semantic Analysis Aaron Bloomfield CS 415 Fall 2005.
XML A web enabled data description language 4/22/2001 By Mark Lawson & Edward Ryan L’Herault.
Of 33 lecture 3: xml and xml schema. of 33 XML, RDF, RDF Schema overview XML – simple introduction and XML Schema RDF – basics, language RDF Schema –
CIS 451: XML DTDs Dr. Ralph D. Westfall February, 2009.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation An Introduction to XML.
An OO schema language for XML SOX W3C Note 30 July 1999.
Jeff Ullman: Introduction to XML 1 XML Semistructured Data Extensible Markup Language Document Type Definitions.
Introduction to Markup David J. Birnbaum University of Pittsburgh Slavic Digital Text Workshop University.
Jennifer Widom XML Data Introduction, Well-formed XML.
1 November 19, November 19, 2015November 19, 2015November 19, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University.
Copyright © 2006 Addison-Wesley. All rights reserved. Ambiguity in Grammars A grammar is ambiguous if and only if it generates a sentential form that has.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2.
1 “Universal Data-Speak”: The eXtensible Markup Language Zack Ives CSE 590DB, Winter 2000 University of Washington 3 January 2000.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
Overview of Previous Lesson(s) Over View  In syntax-directed translation 1 st we construct a parse tree or a syntax tree then compute the values of.
LESSON 04.
XML A Language Presentation. Outline 1. Introduction 2. XML 2.1 Background 2.2 Structure 2.3 Advantages 3. Related Technologies 3.1 DTD 3.2 Schemas and.
Web Technologies Lecture 4 XML and XHTML. XML Extensible Markup Language Set of rules for encoding a document in a format readable – By humans, and –
Applications of XML Oz OceanAtlas Software and NOAA/PMEL.
Structured Documents - XML and FrameMaker 7 Asit Pant.
Representing data with XML SE-2030 Dr. Mark L. Hornick 1.
RuleML Rules Lite Harold Boley, NRC IIT e-Business Said Tabet, Macgregor Corp With Key Contributions from the Joint Committee DAML PI Meeting, Captiva.
PRACTICAL KNOWLEDGE REPRESENTATION FOR THE WEB Frank van Harmelen Dieter Fensel AIFB Kim Kangil Structural Complexity Laboratory.
Introduction to DTD A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Syntax.
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.
Advanced programming language theory. week 2. Attribute grammars and semantics.
PZ03CX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03CX - Language semantics Programming Language Design.
XML BASICS and more…. What is XML? In common:  XML is a standard, simple, self-describing way of encoding both text and data so that content can be processed.
Unit 4 Representing Web Data: XML
Extensible Markup Language XML
Ch. 4 – Semantic Analysis Errors can arise in syntax, static semantics, dynamic semantics Some PL features are impossible or infeasible to specify in grammar.
Eugenia Fernandez IUPUI
Extensible Markup Language XML
The XML Language.
Chapter 7 Representing Web Data: XML
XML Data Introduction, Well-formed XML.
More Sample XML By Sadia Anjum.
ece 720 intelligent web: ontology and beyond
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
SYNTAX DIRECTED DEFINITION
Unit 6 - XML Transformations
Presentation transcript:

Attribute Grammars and XML Workshop on Attribute Grammars, XML, and RDF Institute for Media and Communications Management University of St. Gallen 20/21 Sept Harold Boley, DFKI Kaiserslautern

1 “What Are” and “How Relate” Attribute Grammars and XML? Both are extensions of context-free grammars: –Attribute grammars via semantic (evaluation) rules over attributes –XML via (document-markup) tags, attribute DTDs, stylesheets, etc. Will be compared on two exemplary levels: –Decorated parse trees as attributed element trees –XML markups for semantic rules

2 Attribute Grammar Example: Cartesian Move Sequences Cartesian Move Sequences In the Cartesian plane move stepwise in the directions north, east, south, west Starting from the coordinates X = 0, Y = 0 compute the end position after a finite sequence of moves Sample computations: –Sequence e,e,n shall compute X = 2, Y = 1 –Sequence s,w,s,e shall compute X = 0, Y = -2

3 Grammar with Attributes on Nonterminals Grammar: path   path  step path step  n step  e step  s step  w Attributes: path.  Exx-coordinate of end position path.  Eyy-coordinate of end position step.  Dxincremental change of x-coordinate step.  Dyincremental change of y-coordinate We will only consider synthesized attributes, often prefixed by a “  ”, not inherited attributes

4 Attribute Grammar with Semantic Rules Grammar: path   path  step path step  n step  e step  s step  w Semantic Rules: path.  Ex := 0  path.  Ey := 0 path 1.  Ex := step.  Dx + path 2.  Ex  path 1.  Ey := step.  Dy + path 2.  Ey step.  Dx := 0  step.  Dy := 1 step.  Dx := 1  step.  Dy := 0 step.  Dx := 0  step.  Dy := -1 step.  Dx := -1  step.  Dy := 0

5 Decorated Parse Tree for Sequence e,e,n path step path step path step  e n e Ex = 0 Ey = 0 Ex = 0 Ey = 1 Ex = 1 Ey = 1 Ex = 2 Ey = 1 Dx = 0 Dy = 1 Dx = 1 Dy = 0

6 “e,e,n”-Parse Tree as XML Element e e n path step path step path step  e n e Ex = 0 Ey = 0 Ex = 0 Ey = 1 Ex = 1 Ey = 1 Ex = 2 Ey = 1 Dx = 0 Dy = 1 Dx = 1 Dy = 0 Attributed XML element tree = Decorated parse tree Attribute grammar parse results and intermediate states can thus be represented as XML elements

7 DTD Approximation for Attribute Grammar (AG) ‘Canonical empty elements’ instead of terminals CDATA instead of integers Semantic Rules of full AGs can be added (via XML stylesheets, Java, Prolog,...)

8 “e,e,n”-XML Element According to DTD e e n Terminal e becomes empty element Terminal n becomes empty element

9 path[0,0]([]). path[Nx,Ny]([Head|Tail]) :- step[Dx,Dy](Head), path[Ex,Ey](Tail), Nx.= +(Dx,Ex), Ny.= +(Dy,Ey). step[0,1](n). step[1,0](e). step[0,-1](s). step[-1,0](w). Prolog-like Form of AG with Semantic Rules Attribute values represented as “[...]”-parameters. Call path[X,Y]([e,e,n]) computes X = 2, Y = 1, e.g. using Relfun interpreterRelfun interpreter path.  Ex := 0  path.  Ey := 0 path 1.  Ex := step.  Dx + path 2.  Ex  path 1.  Ey := step.  Dy + path 2.  Ey path   path  step path step  n step  e step  s step  w step.  Dx := 0  step.  Dy := 1 step.  Dx := 1  step.  Dy := 0 step.  Dx := 0  step.  Dy := -1 step.  Dx := -1  step.  Dy := 0

10 Parameter-XML Form of AG via RFML-like Generic Markup path 0 path[0,0]([]). path nx ny head tail path[Nx,Ny] ([Head|Tail]) :- step dx dy head path ex ey tail nx + dx ex ny + dy ey step[Dx,Dy](Head), path[Ex,Ey](Tail), Nx.= +(Dx,Ex), Ny.= +(Dy,Ey). step 0 1 n step 1 0 e step 0 s step 0 w step[0,1](n). step[1,0](e). step[0,-1](s). step[-1,0](w). Generic: User-defined nonterminals (e.g. path ) don’t appear as tags, only between tags

11 Attribute-XML Form of AG via RFML/MathML-like Non-Generic Markup <path ex="0" ey="0"/> path [Ex=0, Ey=0] ([]). <step dx="?" dy="?"/> head Step [Dx=?, Dy=?] (Head), <path ex="?" ey="?"/> tail Path [Ex=?, Ey=?] (Tail), nx dx ex Nx.= +(Dx,Ex), ny dy ey Ny.= +(Dy,Ey). <path nx="?" ny="?"/> head tail path [Nx=?, Ny=?] ([Head|Tail]) :- Output attributes made explicit via “?”-values

12 Conclusions Attribute Grammars and XML use the same parse and element trees There are various possible XML markups for AG’s semantic rules (cf. RFML/MathML) In future work an AG-markup language could be developed and applied for grammar sharing Further levels of the XML/AG relationships should be studied, e.g. attribute dependencies, rule-evaluation methods, and DOM-level rules