Reimplement XSLT pattern matching inside the stack-based VM#126
Open
bojidar-bg wants to merge 1 commit intoPaligo:mainfrom
Open
Reimplement XSLT pattern matching inside the stack-based VM#126bojidar-bg wants to merge 1 commit intoPaligo:mainfrom
bojidar-bg wants to merge 1 commit intoPaligo:mainfrom
Conversation
Now, instruction::ApplyTemplates has been replaced with the leaner instruction::MatchPattern, which in turn allows for a much simpler implementation of xsl:param root-level declarations. Also, implement `#current` mode with a ClosureVar because it's easy. 🎉
ff21111 to
0e43b05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current implementation of
ir::ApplyTemplatesis very rigid, making it hard to run any XPath code before the XSLT pattern-matching engine takes over.After #123 (comment) and plenty of thinking, I've come to the conclusion that the best way forward is to reimplement
ir::ApplyTemplateswithout usinginstruction::ApplyTemplatesandProgram.declarations, so thatir::Declarationscan now become a "normal" IR instruction,ir::DefineTemplates.This should allow for a very easy implementation of root-level
xsl:param-s,xsl:variables-s, andxsl:functions-s, as they can use the whole of the IR implementation, without us having to re-implement parts of it for each global feature in the spec.(I have not fully investigated how this will impact packages, but I imagine that since packages' modes are private by default, having them split into multiple per-package
ir::DefineTemplatesgroups will potentially be helpful once we get there.)Would welcome early feedback of the work so far.
I'll be working on splitting and cleaning the new
function_compiler.rscode in the coming days.