xsl-list
[Top] [All Lists]

Re: [xsl] XSLT has raised bar for compiler writers (my ponderings ..)

2016-10-08 02:30:38
On Fri, 2016-10-07 at 04:32 +0000, Mukul Gandhi 
gandhi(_dot_)mukul(_at_)gmail(_dot_)com
wrote:
[...]
XSLT is a functional language which makes the
process
of writing its compiler different than procedural languages. XSLT
also has
procedural elements, like loops

Strictly speaking XSLT does not have loops. It does have for-each,
which establishes a mapping between a set (or list) of input items and
a set of corresponding result items.

[...]

Given this characteristic of XSLT language, I'm amazed that the
compiler of XSLT language can be made for the full XSLT language,

Functional languages have been around for a long time. There was a
declarative subset of LISP, and by the mid 70s there was also John
Backus' FP language [1] which was functional.

Lazy evaluation and partial evaluation for declarative languages
(whether based on functional calculus and combinators or not) were in
use in the late 70s and early 80s.

There's quite a large research literature in this area.

However, most of the XSLT 2 and XQuery implementations I know of seem
to be interpreted, or to compile down to byte code (rather like, say,
UCSD Pascal in 1980 or so). One reason for this can be if the
implementation supports an eval-like construct, requiring a full
interpreter to be available at runtime.

Implementing XSLT 2 (or 3) is a significant amount of work. I'd love to
see an open source / libre implementation in C that could be called
from PHP, Python, etc., but I think the nearest we're likely to get to
that is Saxon-C from Saxonica. However, I agree for sure that writing
even a partial XSLT compiler may make an interesting exercise.

Liam

-- 
Liam R. E. Quin <liam(_at_)w3(_dot_)org>
The World Wide Web Consortium (W3C)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>