-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Rust Compiler #164
base: master
Are you sure you want to change the base?
[WIP] Rust Compiler #164
Conversation
Everything compiles, and the tests run (even though plenty fail).
I'm finishing some clean-up on the tests; let's merge those at the same time, as it will make things much easier to develop in parallel. |
Recursion is going to be a pain to handle in the future...
How does having separate lifetimes for "read" and "stream" work with instances? As I understand it, the lazy evaluation of instances means they are not evaluated at "read-time". Moreover, they can potentially be wide-ranging, accessing data outside the current stream (e.g., items from the parent or root streams). Will this design hold up under those constraints? (I apologize if I'm creating work for someone else, but I don't speak Rust and I haven't got the bandwidth to try to answer this question myself.) |
No worries, and that's a phenomenal question. Calls to instance calculation use The reason I went with this design is because I'm not sure it's possible to convince Rust that storing references to EDIT: It should also be noted that using That does leave open a question I have for @GreyCat though: What are the semantics for accessing |
Progress continues! We now generate struct bodies correctly, and (almost) all the tests are compiling (and failing). @GreyCat - as mentioned earlier, if you still want to merge, I'm OK with that as we now compile and should run in CI. |
Still need some work on multi-byte reading, but progress is progress.
OK, tests are compiling, and basic parsing code is generating. Tests are still failing, but at least we have things to test against. @CWood1, if you're still around, I could use help with how to plug this into JUnit, and after that, I think it's a matter of continuing to hack on this until it passes the test suite. |
Should be rebased, I think? |
@XVilka - You're right that it would need rebasing, but I don't have the time or desire to continue managing this. If the goal is handling binary parsing in Rust, libraries like I've been leaving this open on the off-chance that someone wants to take it up, but I don't plan on ever returning to this. |
Everything compiles, and the tests run (even though plenty fail).
There's plenty of implementation work left to be done, but this starting point solves (as far as I can tell) all the Rust-specific implementation issues.
A quick note on the design, though I'm planning to do a more in-depth write-up later. There are two lifetimes used to track references: the first is a "read" lifetime, used to communicate references that are valid only while reading, and a "stream" lifetime, used to communicate data that lives as long as the stream from which we're reading. This allows zero-copy parsing (stream lifetime), while still being able to traverse the entire
_root
/_parent
hierarchy (read lifetime).Ultimately, Rust is a bit different because (unlike C++) we never store a reference to
_io
,_root
, or_parent
; they must be provided everywhere they're used (read()
and instance calculation).@CWood1 - I'd be interested in your design input. The lifetimes are a bit thorny (because I need to prove that
_io
references outliveself
,_root
and_parent
), and theTypedStack
implementation I'm using is pretty complex, but I don't know if it's reasonably possible to do any better. Let me know if there's any info I can provide.EDIT: Supersedes and deprecates #161.