Programming Languages & Translators. XML Document Manipulation Language (XDML) Final Report

Similar documents
Programming Languages & Translators. XML Document Manipulation Language (XDML) Language Reference Manual

GAWK Language Reference Manual

B E C Y. Reference Manual

TML Language Reference Manual

Perdix Language Reference Manual

MP 3 A Lexer for MiniJava

Full file at

Typescript on LLVM Language Reference Manual

MP 3 A Lexer for MiniJava

Petros: A Multi-purpose Text File Manipulation Language

Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

COMS W4115 Programming Languages & Translators FALL2008. Reference Manual. VideO Processing Language (VOPL) Oct.19 th, 2008

Java Bytecode (binary file)

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

MATVEC: MATRIX-VECTOR COMPUTATION FINAL REPORT. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

PLT 4115 LRM: JaTesté

Programming Lecture 3

1 Lexical Considerations

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

DINO. Language Reference Manual. Author: Manu Jain

Decaf Language Reference Manual

Java Notes. 10th ICSE. Saravanan Ganesh

Program Fundamentals

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

An ANTLR Grammar for Esterel

Language Reference Manual simplicity

Template Language and Syntax Reference

ASML Language Reference Manual

1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

TaML. Language Reference Manual. Adam Dossa (aid2112) Qiuzi Shangguan (qs2130) Maria Taku (mat2185) Le Chang (lc2879) Columbia University

Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)

Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03

Lexical Considerations

Lexical Considerations

12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

egrapher Language Reference Manual

Basics of Java Programming

BIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

COMP 202 Java in one week

Control Structures. CIS 118 Intro to LINUX

The MaSH Programming Language At the Statements Level

Language Reference Manual

ASTs, Objective CAML, and Ocamlyacc

VENTURE. Section 1. Lexical Elements. 1.1 Identifiers. 1.2 Keywords. 1.3 Literals

Chapter 2 Basic Elements of C++

PIPELINE LANGUAGE REFERENCE MANUAL

Sprite an animation manipulation language Language Reference Manual

2 rd class Department of Programming. OOP with Java Programming

An overview of Java, Data types and variables

Java Programming. Atul Prakash

UNIT- 3 Introduction to C++

d-file Language Reference Manual

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Crayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)

Project 1: Scheme Pretty-Printer

Chapter 2. Lexical Elements & Operators

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

ECE 2400 Computer Systems Programming Fall 2018 Topic 1: Introduction to C

Abstract Syntax Trees

CS164: Programming Assignment 2 Dlex Lexer Generator and Decaf Lexer

SFU CMPT 379 Compilers Spring 2018 Milestone 1. Milestone due Friday, January 26, by 11:59 pm.

Implementing Actions

CSC 467 Lecture 3: Regular Expressions

A clarification on terminology: Recognizer: accepts or rejects strings in a language. Parser: recognizes and generates parse trees (imminent topic)

MOHAWK Language Reference Manual. COMS W4115 Fall 2005

JME Language Reference Manual

Lecture Set 2: Starting Java

String Searching Language

Computer Components. Software{ User Programs. Operating System. Hardware

CHAPTER 2 Java Fundamentals

DEPARTMENT OF MATHS, MJ COLLEGE

IT 374 C# and Applications/ IT695 C# Data Structures

ML 4 A Lexer for OCaml s Type System

GOLD Language Reference Manual

Lecture Set 2: Starting Java

Programming in C++ 4. The lexical basis of C++

PROGRAMMING FUNDAMENTALS

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

Introduction to C# Applications

Lecture 2 Tao Wang 1

Expressions and Data Types CSC 121 Spring 2017 Howard Rosenthal

COLOGO A Graph Language Reference Manual

The Warhol Language Reference Manual

Fundamental of Programming (C)

LaTenS Language Reference Manual

ARG! Language Reference Manual

3. Java - Language Constructs I

Syntax and Grammars 1 / 21

Lecture Code Generation for WLM

Pace University. Fundamental Concepts of CS121 1

Language Fundamentals Summary

Basic Operations jgrasp debugger Writing Programs & Checkstyle

Computer Science II Lecture 1 Introduction and Background

The Java Language The Java Language Reference (2 nd ed.) is the defining document for the Java language. Most beginning programming students expect

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Transcription:

Programming Languages & Translators (COMS W4115) Department of Computer Science Columbia University Summer 2007 XML Document Manipulation Language (XDML) Final Report Luba Leyzerenok ll2310@columbia.edu August 8, 2007

1. Abstract XDML is a simple, high-level language for XML documents manipulation and analysis. This paper will discuss the use of the language, features that I intend to implement and its syntax. I will provide a sample XDML program in the last section. 2. Introduction XML (the Extensible Markup Language) is a W3C-endorsed standard markup language for documents containing structured information. Its main purpose is to facilitate the sharing of data across different information systems, particularly via the Internet. In the last few years, XML has been adopted in fields as diverse as law, aeronautics, finance, insurance, robotics, multimedia, hospitality, travel, art, construction, telecommunications, software, agriculture, physics, etc. XML has become the syntax of choice for newly designed document formats across almost all computer applications. It's used on various OS, including Linux, Windows, Mac OS, and many others. With such wide use of XML, there is obviously a need for a language/technology that lets users manipulate XML documents. There is a wide range of technologies and applications available for programmers use with XML. XDML is a simple, high-level language for XML document manipulation that can be used by people in difference fields, who do not have any prior experience with computer programming. XDML will be written entirely in Java, with use of existing Java APIs, such as DOM, SAX and JAXP. The compiler will convert the XDML source code into Java code that will be compiled by a Java compiler and executed by Java virtual machine. 3. Functionality XDML provides an easy way for users extract data from XML objects. I intend to implement the following functionality: Count elements: given the path to an element, such as Class/Student for example, the count operator will return a number of Student elements in the Class element. Print this function will print the value given the path to an element.

4. Language Features Simple The language targets audience are non-programmers from different industries. Therefore, people without programming experience should be able to read and understand the intent of the code. Intuitive Keywords and syntax are carefully chosen to imitate natural for users (English) language. Reading the code aloud should resemble the instructions dictated by a person to another person. Portability Since the XDML source code is translated into Java code and eventually into Java byte code and executed in Java virtual machine, XDML programs can be executed on any platform and that has Java virtual machine. 5. Syntax 5.1 Data types The following basic data types will be available in XDML: Integer will hold an integer value and identified by an int keyword. String will hold one or more characters and identified by a string keyword. Element will hold a reference to an XML element and identified by an element 5.2 Programming Constructs Loops and flow control structures will be available and have similar syntax to other high-level languages, in particular, Java.

6. XDML Program Example start () { element class = <Class> <Student> <FirstName>Jane</FirstName> <LastName>Miller</LastName> <SSN>987-65-4321</SSN> <Phone>112-112-1212</Phone> </Student> </Class> element student1 = <Student> <FirstName>John</FirstName> <LastName>Smith</LastName> <SSN>123-45-6789</SSN> <Phone>112-112-1212</Phone> <Phone>334-334-3434</Phone> </Student> // returns 1 int students =count (class, Class/Student ) //prints a Student element print (class, Class/Student ) // prints Phone 112-112-1212 and phone 334-334-3434. print (student1, Student/Phone )

7. Language Tutorial XDML is a simple, high-level language for XML documents manipulation and analysis. XDML interpreter takes a source code written in XDML language as input. An XDML source program begins with the word start and is enclosed in a pair of curly braces. XDML has 3 basic types: int, string and element. Variable of each type can be declared and assigned as follows: int students = 10 string name= Joe element student = <Student>Joe<\Student> The print function takes 2 parameters: the variable of type element and the variable of type string. Print searches the element variable for the presence of string element and prints out all occurrences of string in the element. Here is how print would be used: element class = <Class> <Student> <FirstName>Jane</FirstName> <LastName>Miller</LastName> <SSN>987-65-4321</SSN> <Phone>112-112-1212</Phone> </Student> </Class> element student1 = <Student> <FirstName>John</FirstName> <LastName>Smith</LastName> <SSN>123-45-6789</SSN> <Phone>112-112-1212</Phone> <Phone>334-334-3434</Phone> </Student> //prints a Student element print (class, Class/Student ) // prints Phone 112-112-1212 and phone 334-334-3434. print (student1, Student/Phone )

8. Language Reference Manual A. Introduction This manual describes XDML language. B1. Lexical Conventions B2. Tokens There are five classes of tokens: identifiers, keywords, string literals, operators and other separators. B3. Comments The characters // introduce a comment and comment continues until the end of the line. B4. Identifiers An identifier is a sequence of letters, digits and an underscore. The first character must be an either letter or underscore. An identifier may have any length. B5. Keywords The following identifiers are reserved for use as keywords, and may not be used otherwise: element for if else int string B6. Constants There are several kinds of constants: constant: integer-constant string-constant element-const

B5.1 Integer constant An integer constant consists of a sequence of digits and taken to be decimal. B5.2 String constant A string constant is a sequence of characters surrounded by double quotes as in. To represent characters such double quote, newline, backslash and some other characters inside the string constant, the following escape sequence may be used: Newline \n Backslash \\ Question mark \? Less than \< Grater than \> B5.3 Element constant An element constant is a sequence of characters surrounded by < >.Newlines are not allowed in the element constants. C. Basic Types There are several fundamental types. They are integers, strings and elements. The integer type is a 32bit integer. D. Expressions D1. Primary Expressions Primary expressions are identifiers, constants, strings, or expressions in parentheses. primary-expression: identifier constant string ( expression )

D2. Postfix Expressions The operators in postfix expressions group left to right. postfix-expression: primary-expression postfix-expression( string ) postfix-expression.identifier Function call is a postfix expression, called the function designator, followed by parenthesis containing a string variable or literal. E. Operators E1. Unary operator An operand of the unary operator must have a type int. The result is negative of the operand. E2. Additive Operators + and The additive operators + and group left-to-right. The operands of the + and must have type int. The result of the + operator is the sum of the operands. The result of the operator is the difference of the operands. E3. Equality operator The = = operator group left-to-right and evaluates to either 0 or 1. 0 is returned when the operands are equal 1 otherwise. E4. Assignment operator The assignment operator groups right-to-left. The operands must be of the same type. assignment-expression: unary-expression assignment-operator assignment-expression

F. Declarators Declarators are used to specify the data types of an identifier. F1. Variable declarations Declarations have the syntax: Declaration Type identifier G. Statements Statements are executed in sequence and fall into one of the following categories: statement: expression-statement selection-statement iteration-statement G1. Expression statement Expression statement have the form expression-statement: expression G2. Selection statement Selection statements choose one of several flows of control. In both forms of the if statement, the expression, which must have integer type, is evaluated and if it compares equal to 0, the first substatement is executed. Selection-statement: if (expression ) statement if ( expression ) statement else statement

G3. Iteration statement Iterations statements specify looping. iteration-statement: for( expression expression expression ) In the for statement, the first expression is evaluated once, and thus specifies initialization for the loop. The second expression is evaluated before each iteration and if it becomes equal 0, the loop is terminated. This expression must evaluate to an integer data type. The third expression is evaluated after each iteration and this specifies re-initialization for the loop. H. Input and Output XDML program can take a file name, a string, as input. Input of any other type will be discarded. To read an input file, a file has to be open first. Open call has the following syntax: open (filename) Reading a file into a variable of element type, has the following syntax: read(filename) To print to standard output, the syntax is as follows: print ( string ) To close a file: close (filename)

9. Project Plan Process used for planning, specification, development and testing. Since writing a compiler (or an interpreter, in my case) was a new task for me, in the beginning I did not have a clear idea what it entails. So aside from lectures and notes, I started with reading a guide to ANTLR: The Definitive guide to ANTLR by Terence Parr. In addition, I used the authors and Prof. Edward s implementation of a small language from the appendix A of a dragon compiler book as an example and a template. Since I didn t have a clear idea of how the compiler is written, I tended to go from specification to development then to testing and back. I was trying to get the compiler working by working on little pieces and the moving on to the next step once the small part is working. Programming Style Guide. Since this was an individual project, I used the following style that I am the most accustomed to that is based on Sub s recommendations that can be found here: http://java.sun.com/docs/codeconv/. Indentation: 8 spaces ( 2units of 4 ) was used as indentation. Comments: 1. This is a block comment: /* * This is a block comment. */ 2. End-of-line comment: // This is an end of line comment. Declarations: One declaration per line was used. Statements: 0. Each line contains at most one statement. 1. The enclosed statement is intended one more level then the compound statement.

2. The opening brace is at the end of the line that begins the compound statement the close brace begins a line and indented to the beginning of the compound statement. Name Conventions: 1. Class names are nouns that start with a capital letter. 2. Method names are verbs that start with a lower case letter and have the first letter of each internal words capitalized. 3. Names of constants consist of upper case letters. 10. Project Timeline Brainstorming and idea generation White paper June 11,2007 Revised project proposal June 18, 2007 Language Reference Manual June 27, 2007 Lexer July 4, 2007 Parser July 15, 2007 Walker August 1, 2007 Code Generation August 8, 2007 Completing, Testing, Final Report August 10, 2007 11. Roles and responsibilities This was an individual project. Therefore, one person was responsible for everything. 12. Software development environment. 1. Operating System This project was developed under the Windows XP platform 2. Java Java 1.5 was used. I used IntelliJ as a Java IDE. 3. ANTLR The language lexer, parser and walker were written in ANTLR. ANTLR is a parser generator tool that can be used to implement language interpreters, compilers and other translators.

13. Project Log Brainstorming. XDML language idea is created. May 29, 2007 XDML language evolves. Work started on white June 5, 2007 paper. White Paper completed. June 11, 2007 Revising project proposal. Jun 15, 2007 Revised white paper is completed. June 18, 2007 Work started on Language Reference Manual. June 21, 2007 Language Reference Manual completed. June 27, 2007 Work on lexer started. July 4, 2007 Work on parser started. July 15, 2007 Modifying and Extending Lexer July 21, 2007 Modifying and Extending Parser July 21, 2007 Code generation started. July 22, 2007 Work on walker started. August 1, 2007 Lexer, Walker and Parser completed. August 3, 2007 Code Generation August 8, 2007 Completing, Testing, Final Report August 10, 2007

14. Architectural Design. Lexer Parser Walker Generated Code Symbol Table Output

15. Components Interfaces. The XDML language consists of the following components: lexer, parser, walker, symbol table and java source code. The XDML source program is fed into the interpreter. The lexer reads the code and translates it into a stream of tokens. The output of a Lexer is input to the Parser. The parser takes a stream of tokens as input, analyzes the structure of the program and translates a stream of tokens into as Abstract Syntax Tree. Walker takes an AST as input and performs various checks. The interpreter itself reads an AST and executes the program. It looks up the variable definitions in the symbol table and executes the print() function. Since it was an individual project, I worked on all the components. 16. Test Plan. Example of an XDML source program: start () { element class = <Class> <Student> <FirstName>Jane</FirstName> <LastName>Miller</LastName> <SSN>987-65-4321</SSN> <Phone>112-112-1212</Phone> </Student> </Class> element student1 = <Student> <FirstName>John</FirstName> <LastName>Smith</LastName> <SSN>123-45-6789</SSN> <Phone>112-112-1212</Phone> <Phone>334-334-3434</Phone>

</Student> //prints a Student element print (class, Class/Student ) // prints Phone 112-112-1212 and phone 334-334-3434. print (student1, Student/Phone ) I cannot include the target language program here because I was not able to get my interpreter fully working. Despite all my efforts, debugging and investigating, I was not unable to get my interpreter to successfully generate the AST. Test Suit and why it was chosen I used the above example for testing. I chose this example, because it demonstrated all main functionality of the language: the assignment and call to the print function. I did not have any automated testing. 17. Lessons Learned LRM is very critical in this project. The more details are thought out in LRM the easier the development will be. Design phase in general in very important and provides an opportunity to avoid many problems later in the project. Gained understanding of what lexer, parser and AST tree are and how they are supposed to work, even though I was not unable to get my own interpreter working. This was my first experience with ANTLR tool and with writing a compiler in general. Therefore, I learned concepts behind language design, what writing a compiler entails and how to code using ANTLR. 18. Advice for future students. I took this class during the summer semester and was doing the project individually. I think summer semester is not enough time to implement this project alone. Plan carefully. Good design will help to avoid many problems later in the project. Set realistic goals. There is a lot to learn here: language design concepts, writing grammar and parser, using ANTLR, etc.

Appendix. XDML.g class XDMLLexer extends Lexer options { testliterals = false k = 2 charvocabulary = '\3'..'\377' WHITESPACE : (' ' '\t')+ { $settype(token.skip) NEWLINE : ('\n' '\r') { $settype(token.skip) newline() COMMENT : ( "/*" ( options {greedy=false : (NEWLINE) ~( '\n' '\r' ) )* "*/" "//" (~( '\n' '\r' ))* (NEWLINE) ) { $settype(token.skip) NUMBER : ('0'..'9')+ { $settype(int) STRING : '"'! ( ~('"' '\n') ('"'! '"') )* '"'! {$settype(string) ID : ('_' 'a'..'z' 'A'..'Z')('a'..'z' 'A'..'Z' ('0'..'9') '_')* ELEMENT : ( '<' (' ' '\t' )? ID (' ' '\t' )? (ELEMENT)* "</" (' ' '\t' )? ID (' ' '\t' )? '>' )

AND : "&&" OR : " " LE : "<=" GE : ">=" GT : '>' LT : '<' NE : "!=" SEMI : '' LPAREN : '(' RPAREN : ')' LBRACE : '{' RBRACE : '' LBRACK : '[' RBRACK : ']' ASSIGN : '=' EQ : "==" PLUS : '+' MINUS : '-' MUL : '*' DIV : '/' NOT : '!' DOT : '.' COMMA : ',' /****************************************************************************************/ class XDMLParser extends Parser options { buildast = true tokens { NEGATE DECLS program : LBRACE^ decls (statement)* RBRACE! decls : (decl)* { #decls = #([DECLS, "DECLS"], #decls) decl : ("int" "string" "element") ID SEMI! statement : "print"^ LPAREN! ELEMENT COMMA! STRING LPAREN! SEMI /****************************************************************************************/ class XDMLWalker extends TreeParser program returns [Statement s] {s = null : #(LBRACE decls s=statements )

decls { XDMLType t = null : #(DECLS (t=type ID)* ) type returns [XDMLType t] { t = null : ( "int" { t = XDMLType.Int "string" { t = XDMLType.String "element" { t = XDMLType.Element ) statements returns [Statement s] { s = null Statement s1 : s=statement (s1=statements { s = new Sequence(s, s1) )? statement returns [Statement s] { Expr e1, e2 s = null Statement s1, s2 : #(ASSIGN e1=expr e2=expr { if (e1 instanceof ID) s = new Set((ID) e1, e2) ) SEMI expr returns [Expr e] { Expr a, b e = null : #(PRINT a=expr b=expr { e = new Print(a,b)) INT { e = new Expr(#INT.getText(), XDMLType.Int) STRING { e = new Expr(#STRING.getText(), XDMLType.String) ELEMENT { e = new Expr(#ELEMENT.getText(), XDMLType.Element) Expr.java public class Expr extends XDMLNode { private String mtoken private XDMLType mtype public String gettoken() { return mtoken

public void settoken(string ptoken) { mtoken = ptoken public XDMLType gettype() { return mtype public void setmtype(xdmltype mtype) { this.mtype = mtype Expr(String ptoken, XDMLType ptype){ mtoken = ptoken mtype = ptype Expr(Expr ptoken, Expr ptype){ mtoken = ptoken.gettoken() mtype = ptype.gettype() public void jumpto (String test, int falsevalue, int truevalue){ if (truevalue!= 0 && falsevalue!= 0) { getvalue("if " + test + " goto L" + truevalue) getvalue("goto L" + falsevalue) else if (truevalue!= 0) getvalue("if " + test + " goto L" + truevalue) else if (falsevalue!= 0) getvalue("ifflase " + test + " goto L" + falsevalue) public String tostring() { return mtoken ID.java public class ID extends Expr { public ID(String pid, XDMLType ptype){ super(pid, ptype) Main.java import antlr.commonast import antlr.debug.misc.astframe

import java.io.* class Main { public static void main(string[] args) { try { String filename = args[0] if (filename == null && filename.trim().length() == 0){ System.out.println("No argument was passed.") FileInputStream input = new FileInputStream( filename ) XDMLLexer lexer = new XDMLLexer(input) XDMLParser parser = new XDMLParser(lexer) parser.program() CommonAST mast = (antlr.commonast) parser.getast() System.out.println("List:\t" + mast.tostringlist()) System.out.println("Tree:\t" + mast.tostringtree()) XDMLWalker walker = new XDMLWalker() Statement statement = walker.program(mast) ASTFrame mframe = new ASTFrame("ASTree", mast) mframe.setvisible(true) catch (FileNotFoundException f) { System.out.println("Main.main()\tFileNotFoundException" + f.getstacktrace()) catch (Exception e){ System.out.println("Main.main()\tException" + e.getstacktrace()) print.java public class Print extends Expr{ public Print (Expr ptype, Expr pname){ super(ptype, pname) Sequence.java public class Sequence extends Statement { Statement mstatement1 Statement mstatement2 public Sequence(Statement pstatement1, Statement pstatement2){

mstatement1 = pstatement1 mstatement2 = pstatement2 public void gen(int b, int a){ int label = createnewlabel() mstatement1.gen(b, label) getlabel(label) mstatement1.gen(b, label) set.java public class Set extends Statement { public ID mlvalue public Expr mexpr public Set(ID pid, Expr pexpr){ mlvalue = pid mexpr = pexpr public XDMLType validatetype (XDMLType ptype1, XDMLType ptype2) { if (ptype1 == ptype2) return ptype1 else if (ptype1.element == ptype2.element) return ptype1 else if (ptype1.int == ptype2.int) return ptype1 else if (ptype1.string == ptype2.string) return ptype1 else return null statement.java public class Statement extends XDMLNode { public void gen(int b, int a){ XDMLNode.java public class XDMLNode { void error(string perrormsg) { throw new Error(pErrorMsg) static int labels = 0 public static int createnewlabel() {

return ++labels public static void getlabel(int i) { System.out.print("L" + i + ":") public static void getvalue(string s) { System.out.println("\t" + s) XDMLSymbolTable.java public class XDMLSymbolTable { private XDMLSymbolTable mparent private HashMap mtable = new HashMap() public void XDMLSymbolTable (XDMLSymbolTable psymtable){ mparent = psymtable public ID getid (String pname){ for (XDMLSymbolTable temptable = this temptable!= null temptable = temptable.mparent) { ID id = (ID)(tempTable.mTable.get(pName)) if (id!= null) return id return null public void addid(string pname, XDMLType ptype){ mtable.put(pname, new ID (pname, ptype)) XDMLType.java public class XDMLType { public String mtype public XDMLType(String ptype){ mtype = ptype public static XDMLType Int = new XDMLType("int") public static XDMLType String = new XDMLType("string") public static XDMLType Element = new XDMLType("element")