1 / 13

A Lisp Subset Based on MathML

2. Introduction. Interest: XML representation for programming languagesExploration: content MathML as an expression for a functional programming language, a Lisp subsetDevelopment: XML-Scheme interpreter in JavaDemonstration: content MathML is quite sufficient for this purposeSuggestion: pot

mauli
Download Presentation

A Lisp Subset Based on MathML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. 1 A Lisp Subset Based on MathML Yuzhen Xie Stephen M. Watt Luca Padovani June 2002

    2. 2 Introduction Interest: XML representation for programming languages Exploration: content MathML as an expression for a functional programming language, a Lisp subset Development: XML-Scheme interpreter in Java Demonstration: content MathML is quite sufficient for this purpose Suggestion: potential of a web scripting language encoded in XML (possibly based on MathML)

    3. 3 Content MathML as the Nucleus of a Functional Programming Language Focus of XML: structure Potential to create a programming language framework in XML, i.e. control, data flow, functions, format of message passing, etc. Advantages of programs in XML format: standardization of the encoding format, independence of the delivery medium, etc.

    4. 4 Content MathML as the Nucleus of a Functional Programming Language (contd) Selection of the programming language: Lisp S-Expressions Content markup of MathML as an expression: - lambda constructs and definitions: apply, lambda, piecewise, declare, and csymbol - recursive use of container elements - nested building of constructs - flexibility provided by csymbol, e.g. for cons, and () - types

    5. 5 Content MathML as the Nucleus of a Functional Programming Language (contd) Content MathML as an expression example: MathML content markup of (define reverse-subtract (lambda (x y) (- y x))) is: <declare> <ci>reverse-subtract</ci> <lambda> <bvar><ci>x</ci></bvar> <bvar><ci>y</ci></bvar> <apply> <minus/> <ci>y</ci> <ci>x</ci> </apply> </lambda> </declare>

    6. 6 XML-Scheme Syntax and Grammar Most of the first class operators, constants and symbols, expressions, and function definitions are represented in the core content elements of MathML 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: cons, car, cdr, (), null? Additional top element: xml-scheme Defined syntax rules for expression reduction and parameter passing: e.g. apply and ci

    7. 7 A complete example of XML-Scheme program that uses +, -, *, cons, if, lambda, and define <?xml version=1.0 encoding=UTF-8?> <xml-scheme> <!-- (define my_pair (cons 1 -1)) --> <declare> <ci>my_pair</ci> <apply> <csymbol>cons</csymbol> <cn>1</cn> <cn>-1</cn> </apply> </declare>

    8. 8 A complete example of XML-Scheme program that uses +, -, *, cons, if, lambda, and define

    9. 9 <!-- (define myfun (compose-fn my_abs my_double))--> <declare> <ci>myfun</ci> <apply> <ci>compose-fn</ci> <ci>my_abs</ci> <ci>my_double</ci> </apply> </declare> <!-- (myfun (car my_pair)) --> <apply> <ci>myfun</ci> <apply> <csymbol>car</csymbol> <ci>my_pair</ci> </apply> </apply> </xml-scheme> A complete example of XML-Scheme program that uses +, -, *, cons, if, lambda, and define (contd)

    10. 10 XML-Scheme Interpreter

    11. 11 Quotation A PHP fragment: <? print("<ul>"); for ($ix = 0; $ix < count($stuff); $ix++) { print("<li> $ix. $stuff($ix) </li>\n"); } ?> Structure difficult to maintain -- note missing </ul>. Potential: using Lisp-style quasi-quoting mechanism for XML documents in a natural, structured manner Lisp example: (list ,(+ 1 2) 4) => (list 3 4)

    12. 12 Quotation (contd) Proposition: - A scripting model for XHTML documents as quasi-quoted data - Scripting components are in XML syntax - Evaluation is indicated by the unquoting mechanism as comma in Scheme

    13. 13 Concluding Remarks Prototype of XML-Scheme interpreter Implementation of a basic set of Scheme operators, lambda calculus and definitions Feasibility of content MathML to represent a simple functional programming language, Scheme Potential uses of programming languages represented in XML, in particular, a new family of scripting languages for Web pages

More Related