I had hoped this would be considerably easier to implement, but there are some confounding factors. First of all: this accomplishes the initial task of getting nested template applications and definitions re-output in the `xmli` file. But to do so successfully, some assumptions had to be made. The primary issue is that of scope. The old (XSLT-based) TAME relied on the output JS to handle lexical scope for it at runtime in most situations. In the case of the template system, when scoping/shadowing were needed, complex and buggy XPaths were used to make a best effort. The equivalent here would be a graph traversal, which is not ideal. I had begun going down the rabbit hole of formalizing lexical scope for TAMER with environments, but I want to get this committed and working first; I've been holding onto this and breaking off changes for some time now. DEV-13708 |
||
---|---|---|
.. | ||
classify | ||
combined | ||
empty | ||
rate | ||
template | ||
.gitignore | ||
README.md | ||
test-xmli |
README.md
XMLI System Test
The xmli
file is an intermediate file that serves as a handoff between
TAMER and the XSLT-based compiler:
xml -> (TAMER) -> xmli -> (TAME XSLT) -> xmlo
TAMER gets the first shot at processing, and then the compilation process continues with the XSLT-based compiler. This allows TAMER to incrementally augment and manipulate the source file and remove responsibilities from TAME XSLT.
Tests in this directory ensure that this process is working as intended. TAMER's failure to perform a proper handoff will cause TAME XSLT to compile sources incorrectly, since TAMER will have rewritten them to something else.
This handoff is more than just echoing tokens back into a file---it derives a new program from the state of the ASG. This program may have a slightly different representation than the original sources, but it must express an equivalent program, and the program must be at least as performant when emitted by TAME XSLT.
Running Tests
Test are prefixed with test-*
and are executable. They must be invoked
with the environment variable PATH_TAMEC
set to the path of tamec
relative to the working directory.
Test cases are organized into sub-directories with src.xml
and
expected.xml
files. src.xml
will be compiled with tamec
, its output
formatted with xmllint --format
, and diff
'd against the
xmllint
-formatted output of expected.xml
.