Implement Yarn Spinner 3 Virtual Machine and Parser - #284
Draft
LittleFinix wants to merge 15 commits into
Draft
Conversation
…are now in the generated lexer, and fix the one regression found from the new dep compared to previous in get_hashable_interval.
Also regenerate generated files in `core/src/generated`. This does not (yet) change the code generator nor the logic inside of run_instruction in the vm.
The NodeBuilder further abstracts the emitter process. It specifically allows setting the destination fields of jump and jump-like instructions, which is required for the Yarnspinner 3 system.
# Conflicts: # crates/compiler/src/listeners/compiler_listener.rs
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.
This PR kicks of the implementation of Yarn Spinner 3 based on the commits from #278 and #281. The parser and VM have been adapted to the upstream versions using the provided antlr and protobuf files.
The bulk of this PR is adapting to the new protobuf structures. Instructions are now encoded using a
oneofmember in the instruction message instead of using protobuf'senumtype, which meshes better with rusts variant enums. Labels have been removed, instead instructions now directly refer to the destination address inside the node. The newNodeBuildertype andemit!macro simplify the updated code generator visitor.Adapting the VM to the new instruction format was pretty straight forward.
With the addition of the detour command the VM now needs to manage a call-stack in order to deal with returns. The call-stack is implemented as a stack of VM states.
Not all features from Yarn Spinner 3 are implemented yet. Also someone with more experience in rust than me should probably look this over.
Features
<<detour>>&<<return>>: Call-into and return-from a node.<<once>>& line conditions: Lines that are only shown once or when specific conditions are met.