MathML Conference 2002: Presentations
نویسندگان
چکیده
We are interested in an XML representation for programming languages. Could content markup of MathML be used for this purpose, especially in the setting of a functional programming language? In order to address this question we have developed an interpreter for a Scheme-like language encoded in XML. We demonstrate that, with some degree of extension to its core elements, syntax and default semantics of content MathML are quite sufficient to represent Scheme expressions. We also describe the basic architecture of the interpreter, which has been written in Java. Our work suggests that the potential of a web scripting language encoded in XML (possibly based on MathML) is very high. In particular, it offers very natural mechanisms to construct XML expressions dynamically incorporating desired XML subexpressions. 1. Content MathML as the Nucleus of a Functional Programming Language XML (eXtensible Markup Language) [1] is used to describe structured documents by user-defined markup tags. Due to its focus on structure, XML can be easily used to create a programming language framework where all the programming constructs like control and data flow, functions, format of message passing, are encoded in XML. Programs encoded in this form could immediately have the advantages of XML, in particular standardization of the encoding format, independence of the delivery medium, easiness of parsing by standard software tools. A natural place to start an investigation into these ideas is with the Lisp family of languages, as Lisp S-Expressions and XML are quite similar. In fact, it has been previously noted that XML documents can be represented as S-Expressions [2]. We address the question of the opposite embedding. To this aim we consider the SExpressions of the Scheme [3] dialect of Lisp. In another paper [4], Boley has considered content markup in MathML as a sub-language for Lisp-like notation, with a view to develop a markup language for functional relations. To start with, we investigate the content markup of MathML [5] as an expression language. For example, the Scheme expression (lambda (x) (+ x x)) can be represented in MathML content markup as: x// x x Since the intent of content markup in MathML is to provide an explicit encoding of the structure underlying a mathematical expression, it is quite rich in describing lambda constructs and definitions. For instance, the apply element corresponds to a complete mathematical expression where an operator (or a function) is applied to its arguments. The lambda element is used to construct a function given a list of http://www.mathmlconference.org/2002/presentations/xie/ (1 of 7)6/28/2005 11:23:02 AM MathML Conference 2002: Presentations variables to bind (the functions' arguments) and an expression (the function's body). A declare construct associates specific properties or meanings to a mathematical object. Identifiers, numbers and symbols are encoded by ci, cn, and csymbol respectively. csymbol, in particular, can be used to extend content MathML when none of the default elements is suitable to represent a specific operator or a specific function. The characteristics of the container elements in MathML content markup make them adequate to represent expressions, functions, and definitions in a programming language. Container elements are used in a simple, recursive way and constructs can be nested at arbitrary depth. As a more complete example, the Scheme expression (define reverse-subtract (lambda (x y) (y x))) can be encoded as the following MathML content fragment: reverse-subtract x y y x After having established such encoding, the next natural step is the definition of a notion of expression evaluation in MathML. MathML does not encompass any notion of parameter passing. Furthermore, some operators and symbols that are specific to Scheme, such as cons and '(), are not part of the core content elements in MathML. But, as we noticed before, content MathML provides a csymbol element whose semantics can be defined externally by the user. Such element gives content MathML enough flexibility to be used as a programming language. There is also an issue about types: MathML types do not correspond directly to the types of Scheme. Although the cn element has an attribute type that can be used to specify the type of numbers, the data types available are far too simple and not extendible. In particular, there is no way to declare complex data types for pairs or lists in Scheme. Nevertheless, since Scheme is loosely and dynamically typed, data typing can be handled in the XML-Scheme interpreter. 2. XML-Scheme Syntax and Grammar The XML-Scheme language is described by the content MathML elements with some degree of extension to its elements. The core content elements of MathML are used to represent most of the first class operators, constants and symbols, data flow and control, expressions, and function definitions. As already anticipated, the csymbol element is used to create symbols having a particular meaning in Scheme but that are not part of the core content elements in MathML. Even though it would be easier to define tags and semantics for symbols such as , this approach is not extendible, and treats some functions, like cons, differently from other functions like reverse-subtract. The core content MathML together with the elements created using csymbol form XML-Scheme, which is an XML representation for a Lisplike subset of functional programming language. In this study, a few new elements were invented to meet the particular http://www.mathmlconference.org/2002/presentations/xie/ (2 of 7)6/28/2005 11:23:02 AM MathML Conference 2002: Presentations requirements in Scheme. These were represented as a set of csymbols. In practice, these could equally well be elements in a separate namespace. The element is used as the root element in a document representing a program written in XML-Scheme. The Scheme constant '() is denoted by the symbol null. The Scheme constructor and destructors for pairs are denoted by the symbols cons, car, and cdr. The Scheme null? operator is denoted by a null? symbol in XMLScheme. We define a number of syntactic rules that define expression reduction and parameter passing. An apply construct whose first child is one of the first class operators or lambda construct performs operation on the rest of its children which are operands. An apply construct whose first child is ci indicates that its first child is an identifier to a function, and the rest of its children are the argument list. What follows is a complete example of XML-Scheme program that uses +, -, *, cons, if, lambda, and define. The corresponding Scheme expressions are illustrated in the XML comments.
منابع مشابه
Syntactic Feature of EFL Speakers’ Conference Presentations: The Case of Passive Voice and Pseudo-Cleft
Acquiring proficiency in academic genres is a key factor in research community. Among various genres in academic discourse communities, spoken genre, especially Conference Presentations (CPs), play a crucial role in research communities, though investigation on this important genre is in its infancy or is relatively under-researched. Therefore, the present study aims to shed light on the import...
متن کاملExploiting Implicit Mathematical Semantics in Conversion between TEX and MathML
We present a new strategy for conversion between TEX mathematical expressions and MathML. Previous efforts have attempted either superficial high level transliteration or full execution of TEX. We observe that document markup typically uses macros that relate to semantics, and show how this structure can be exploited in the translation process. We present the overall architecture of two impleme...
متن کاملWho? What? Where? A snapshot of Nuclear Medicine Research Presentations from recent ANZSNM conferences in Australia and New Zealand.
Objective(s): The aims of this study were to: 1) discover location (by city) of contributors to poster and oral presentations at recent ANZSNM conferences; 2) determine the nuclear medicine themes most commonly explored; 3) establish institutions producing the highest number of oral and poster abstracts and 4) determine publication rates of conference abstracts to full...
متن کاملThe 50th ASMS Conference on Mass Spectrometry and Allied Topics
Development of new mass spectrometers and implementation of new analytical methods were the central themes of the conference. The majority of oral presentations and posters were concerned with the application of mass spectrometry to pharmaceutical and biotechnological research.
متن کاملSpecial Issue for 13th International Industrial Engineering Conference (IIEC 2017)
This special issue is a collection of refereed articles selected from the 13th International Industrial Engineering Conference (IIEC 2017). The initial selection was made by Dr. Hamed Fazlollahtabar who also wrote the following description. The accepted articles were reviewed going through the usual reviewing process of IJOR. Nezam Mahdavi-Amiri Editor-in-Chief &nbs...
متن کامل