Mike Gerwitz
c19ecba6ef
This enforces the new constraint that templates expanding into an `Expr` context must only inline a single `Expr`. Perhaps in the future we'll support explicit splicing, like `,@` in Lisp. But this new restriction is intended for two purposes: - To make templates more predictable (if you have a list of expressions inlined then they will act differently depending on the type of expression that they are inlined into, which means that more defensive programming would otherwise be required); and - To make expansion easier, since we're going to have to set aside an expansion workspace ahead of time to ensure ordering (Petgraph can't replace edges in-place). If we support multi-expansion, we'd have to handle associativity in all expression contexts. This'll become more clear in future commits. It's nice to see all this hard work coming together now, though; it's easy now to perform static analysis on the system, and any part of the graph construction can throw errors with rich diagnostic information and still recover properly. And, importantly, the system enforces its own state, and the compiler helps us with that (the previous commits). DEV-13163 |
||
---|---|---|
.. | ||
classify | ||
combined | ||
cp | ||
empty | ||
meta-interp | ||
package | ||
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.
Experimental Features
If a file is-experimental
exists in a test directory, then
--emit xmlo-experimental
will be used in place of --emit xmlo
.
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
.