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

Subject: Re: [xsl] XSLT has raised bar for compiler writers (my ponderings ..)
From: "Liam R. E. Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 8 Oct 2016 07:30:32 -0000
On Fri, 2016-10-07 at 04:32 +0000, Mukul Gandhi gandhi.mukul@xxxxxxxxx
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@xxxxxx>
The World Wide Web Consortium (W3C)

Current Thread