Top Banner
March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages Programming Languages (ICE 1341) (ICE 1341) Lecture #8 Lecture #8 March 19, 2004 In-Young Ko iko .AT. i cu . ac.kr Information and Communications University (ICU)
14

March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

Dec 27, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Programming LanguagesProgramming Languages(ICE 1341)(ICE 1341)

Lecture #8Lecture #8 March 19, 2004

In-Young Koiko .AT. icu.ac.kr

Information and Communications University (ICU)

Page 2: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 2 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Review of the Previous LectureReview of the Previous Lecture

Program BlocksProgram Blocks Scoping RulesScoping Rules

Static ScopingStatic Scoping Dynamic ScopingDynamic Scoping

Scoping IssuesScoping Issues Scope LifetimeScope Lifetime Reference EnvironmentsReference Environments Named ConstantsNamed Constants Variable InitializationVariable Initialization

Page 3: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 3 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

The World Wide Web (WWW)The World Wide Web (WWW)

““Information Management: Information Management: A Proposal”, A Proposal”, Tim Berners-Tim Berners-LeeLee, , CERNCERN, March 1989, March 1989

A proposal to build a A proposal to build a global global hypertext systemhypertext system for CERNfor CERN

www.w3.org/History/1989/www.w3.org/History/1989/proposal.htmlproposal.html

The original proposal of the WWWThe original proposal of the WWW

Page 4: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 4 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

WWW ConceptsWWW Concepts

HypertextHypertext

Universal ReadershipUniversal Readership

SearchingSearching Client-Server ModelClient-Server Model

FormatFormatNegotiationNegotiation• Image formatsImage formats• Text fontsText fonts• FramesFrames

www.w3.org/Talks/General/Concepts.htmlwww.w3.org/Talks/General/Concepts.html

Page 5: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 5 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Languages for WWWLanguages for WWW

HTMLHTML (Hypertext Markup Language) (Hypertext Markup Language) Scripting Languages (e.g., Perl, JavaScript)Scripting Languages (e.g., Perl, JavaScript) XMLXML (Extended Markup Language) (Extended Markup Language) RDFRDF (Resource Description Framework) (Resource Description Framework) DAMLDAML (DARPA Agent Markup Language) (DARPA Agent Markup Language) SOAPSOAP (Simple Object Access Protocol) (Simple Object Access Protocol) WSDLWSDL (Web Services Description Language) (Web Services Description Language) WSFLWSFL (Web Services Flow Language) (Web Services Flow Language) ……

Page 6: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 6 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Extended Markup Language (XML)Extended Markup Language (XML)

A flexible text format that is originally designed for A flexible text format that is originally designed for large-large-scale electronic publishing of documentsscale electronic publishing of documents

DDerived from SGML (Standard Generalized Markup erived from SGML (Standard Generalized Markup LanguageLanguage, , ISO 8879ISO 8879))

An An XML documentXML document is a is a hierarchical organizationhierarchical organization of one of one or more named elementsor more named elements An An elementelement is composed of an opening-tag, data (string or is composed of an opening-tag, data (string or

another element), and a closing-taganother element), and a closing-tag An An opening-tagopening-tag is an element name surrounded by ‘<’ and ‘>’ is an element name surrounded by ‘<’ and ‘>’ A A closing-tagclosing-tag is an element name surrounded by ‘<’ and ‘/>’ is an element name surrounded by ‘<’ and ‘/>’ An element may have zero or more attributesAn element may have zero or more attributes An An attributeattribute is a name-value pair that specifies a property of the is a name-value pair that specifies a property of the

elementelement

Page 7: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 7 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

An XML Document ExampleAn XML Document Example

<class><class><name><name>Prog. Lang.Prog. Lang.</name></name><code><code>ICE1341ICE1341</code></code><students><students>

<student <student id=“20037001”id=“20037001”>> <name><name>Y.K. KoY.K. Ko</name></name> <bday><bday>820304820304</bday></bday></student></student><student <student id=“20037002”id=“20037002”>> <name><name>D.W. D.W.

KimKim</name></name> <bday><bday>830512830512</bday></bday></student></student>

</students></students></class></class>

An opening-tagAn opening-tag

A closing-tagA closing-tag

An elementAn element

An attributeAn attribute

The root elementThe root element

A valueA value

Page 8: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 8 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

The XML GrammarThe XML Grammar

document   ::=   document   ::=   prologprolog elementelement MiscMisc** element   ::=   element   ::=   EmptyElemTagEmptyElemTag | | STagSTag contentcontent ETagETag EmptyElemTag   ::=   'EmptyElemTag   ::=   '<<' ' NameName ( (SS AttributeAttribute)* )* SS? '? '/>/>'' STag   ::=   'STag   ::=   '<<' ' NameName ( (SS AttributeAttribute)* )* SS? '? '>>'' content   ::=   content   ::=   CharDataCharData? ((? ((elementelement | | ReferenceReference | |

CDSectCDSect | | PIPI | | CommentComment) ) CharDataCharData?)*?)* ETag   ::=   'ETag   ::=   '</</' ' NameName SS? '? '>>'' S   ::=   (S   ::=   (#x20 #x20 | | #x9#x9 | | #xD#xD | | #xA#xA)+)+ Attribute   ::=   Attribute   ::=   NameName EqEq AttValueAttValue Name   ::=   (Name   ::=   (LetterLetter | ' | '__' | '' | '::') (') (NameCharNameChar)*)* Comment   ::=   'Comment   ::=   '<!--<!--' ((' ((CharChar - ' - '--') | ('') | ('--' (' (CharChar - ' - '--')))* '')))* '-->-->''

XML Spec: XML Spec: http://www.w3.org/TR/2004/REC-xml-20040204/http://www.w3.org/TR/2004/REC-xml-20040204/

Page 9: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 9 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

An XML Document GrammarAn XML Document Grammar

<class><class><name><name>Prog. Lang.Prog. Lang.</name></name><code><code>ICE1341ICE1341</code></code><students><students>

<student <student id=“20037001”id=“20037001”>> <name><name>Y.K. KoY.K. Ko</name></name> <bday><bday>820304820304</bday></bday></student></student><student <student id=“20037002”id=“20037002”>> <name><name>D.W. D.W.

KimKim</name></name> <bday><bday>830512830512</bday></bday></student></student>

</students></students></class></class>

class class “<class>” node “</class> “<class>” node “</class>

node node name code students name code students

name name “<name>” string “</name>” “<name>” string “</name>”

code code “<code>” string “</code>” “<code>” string “</code>”

students students “<students>” student* “<students>” student* “</students>”“</students>”

student student “<student” S “id=\”” num “<student” S “id=\”” num “\”” S “/>” name birthday “\”” S “/>” name birthday “</student>”“</student>”

birthday birthday “<bday>” num “</bday>” “<bday>” num “</bday>”

Page 10: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 10 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

XML Document ProcessXML Document Process

<class><class><name><name>Prog. Lang.Prog. Lang.</name></name><code><code>ICE1341ICE1341</code></code><students><students>

<student <student id=“20037001”id=“20037001”>> <name><name>Y.K. KoY.K. Ko</name></name> <bday><bday>820304820304</bday></bday></student></student><student <student id=“20037002”id=“20037002”>> <name><name>D.W. D.W.

KimKim</name></name> <bday><bday>830512830512</bday></bday></student></student>

</students></students></class></class>

DocumentDocument ElementElement (tagName=“class”) (tagName=“class”)

-- childNode(0)-- childNode(0) ElementElement (tagName=“name”, (tagName=“name”,

nodeValue=“Prog. Lang.”)nodeValue=“Prog. Lang.”) -- childNode(1) …-- childNode(1) … -- childNode(2)-- childNode(2) ElementElement (tagName=“students”) (tagName=“students”)

-- childNode(0)-- childNode(0) ElementElement (tagName=“student”, (tagName=“student”, attribute(0)=“id”:“20…”)attribute(0)=“id”:“20…”) -- childNode(0)-- childNode(0) ElementElement (tagName=“name”, (tagName=“name”,

nodeValue=“Y.K…”)nodeValue=“Y.K…”) -- childNode(1)-- childNode(1) ElementElement (tagName=“bday”, … (tagName=“bday”, …

DOM (Document Object Model)DOM (Document Object Model)

Page 11: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 11 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

XML ProcessorsXML Processors

XML ParsersXML Parsers: read XML documents and : read XML documents and provide access to their content and structure via provide access to their content and structure via DOM (e.g., Xerces, Sun’s Java XML Parser)DOM (e.g., Xerces, Sun’s Java XML Parser)

Document Filtering (Validation)Document Filtering (Validation) Document Type Declaration (DTD)Document Type Declaration (DTD): a : a grammargrammar for for

a class of XML documents a class of XML documents XML Schema (XSD)XML Schema (XSD): a successor of DTD. : a successor of DTD.

Describes the structure of an XML documentDescribes the structure of an XML document XML PresentationXML Presentation

eXtensible Stylesheet Language (XSL)eXtensible Stylesheet Language (XSL): a : a language to define the transformation and language to define the transformation and presentation of an XML documentpresentation of an XML document

Page 12: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 12 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

XML Processing StepsXML Processing Steps

XML XML DocumentDocument

DatabasesDatabases

XML ParserXML Parser

DTD/ DTD/ XMLSchemaXMLSchema

XSL XSL DescriptionDescription

XSL ProcessorXSL Processor

XML Grammar XML Grammar (Structure) Validation(Structure) Validation

classclass

namename codecode studentsstudents

Prog. LangProg. Lang ICE1341ICE1341 studentstudent studentstudent

namename bdaybday namename bdaybday

Y.K. KoY.K. Ko 820304820304 D.W. KimD.W. Kim 830512830512

DOM ObjectsDOM Objects

HTML HTML PresentationPresentation

Page 13: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 13 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Related MaterialsRelated Materials

W3C’s XML Web Site: W3C’s XML Web Site: http://www.w3.org/XML/http://www.w3.org/XML/ XML Specification: http://www.w3.org/TR/2004/REC-XML Specification: http://www.w3.org/TR/2004/REC-

xml-20040204/xml-20040204/ XML Concepts: XML Concepts:

http://www.w3.org/Talks/General/Concepts.htmlhttp://www.w3.org/Talks/General/Concepts.html DTD Tutorial: http://www.w3schools.com/dtd/DTD Tutorial: http://www.w3schools.com/dtd/ XML Schema Tutorial: XML Schema Tutorial:

http://www.w3schools.com/schema/default.asphttp://www.w3schools.com/schema/default.asp W3C’s XSL Site: http://www.w3.org/Style/XSL/W3C’s XSL Site: http://www.w3.org/Style/XSL/ Other XML-related Notes: Other XML-related Notes:

http://www.w3.org/XML/notes.htmlhttp://www.w3.org/XML/notes.html

Page 14: March 19, 2004 1 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko Programming Languages (ICE 1341) Lecture #8 Programming Languages (ICE 1341)

March 19, 2004 14 ICE 1341 – Programming Languages (Lecture #8) In-Young Ko

Term Project #1Term Project #1

Design a Design a structured programming languagestructured programming language that includes the that includes the following language componentsfollowing language components Type declaration statements for Type declaration statements for int, float, char, arrayint, float, char, array Operations: Operations: +, -, *, /, and, or, not+, -, *, /, and, or, not Assignment statementAssignment statement Conditional statement (Conditional statement (ifif statement) statement) Loop (Loop (whilewhile statement) statement) Program blocks (Program blocks (beginbegin … … endend))

Develop an Develop an XML-based syntaxXML-based syntax of the language of the language Write the Write the grammargrammar of the language in EBNF of the language in EBNF Write a Write a sample programsample program by using the language that you defined by using the language that you defined Display the sample program on MS Internet Explorer to validate Display the sample program on MS Internet Explorer to validate

its XML syntaxits XML syntax Explain the Explain the language design decisionslanguage design decisions such as application such as application

domains, and naming, binding, type compatibility, scoping rulesdomains, and naming, binding, type compatibility, scoping rules

Due by April 2ndDue by April 2nd