-
Notifications
You must be signed in to change notification settings - Fork 48
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
Assembler simplification (pending state removal) #133
Conversation
@lightclient @SamWilsn the assembler rewrite is ready. If anyone has time during the week to review the code, I'll be happy to address your comments :) P.S: I'm tagging you two because you're the two people I've been talking to about the assembler rewrite. If you don't have time, feel free to ignore this message. |
@gzanitti we're the correct people to tag for sure! I'm swamped for the rest of the week, but I start my vacation next week so I should finally have some time for ETK 🎉 |
That's great! :). Anyway, today I was playing around with an ERC20 implementation I was working on (basically moving various parts of the code into macros, adding includes/imports) and I found a bug. Which I thought I had fixed a few hours ago, but it turns out that the new change breaks some "push label"s haha. I'll try to fix it in the next few days, but I'm starting to think it might need a bit of a major rewrite. I'll keep you posted. |
That might be the best approach. Keep the pest parser and scrap the rest.
…On Wed, Sept 27, 2023, 18:39 Gastón Zanitti ***@***.***> wrote:
@gzanitti <https://github.com/gzanitti> we're the correct people to tag
for sure! I'm swamped for the rest of the week, but I start my vacation
next week so I should finally have some time for ETK 🎉
That's great! :). Anyway, today I was playing around with an ERC20
implementation I was working on (basically, moving different parts of the
code to macros, adding includes/imports) and I found a bug. Which I thought
I had fixed a few hours ago, but it turns out that the new change breaks
some "push label"s haha.
I'll try to solve it in the next few days, but I'm starting to think it
might need a bit of a major rewrite. I'll keep you posted.
—
Reply to this email directly, view it on GitHub
<#133 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANU4EQOXIUOWPKZQGSYCE5DX4STJXANCNFSM6AAAAAA46VVE2I>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Excellent. I tried not to do that from the very beginning, because I was trying to preserve as much of the original code as possible (I didn't want to be the outsider who comes to break everything). You're going to say it wasn't necessary, but it's good to have your approval to make a deeper change haha. I have some ideas I'd like to try that I think will help simplify the whole compiler. I'll keep you posted. Thanks! |
Small update: I'm almost done with the new code. The truth is: There are no big changes, just some reorganizations. Roughly, these are the major changes:
I still need to fix a few things. Most importantly, I would like to add some more tests that make use of the dynamic push of labels (%push(label)) to make sure everything is working properly. Also, the handling and resolution of paths in each include/import is just a "hacky patch". And there is a test that fails when the push label is an expression. Nothing that is likely to be a major headache, but I'd like to have it sorted out before you guys take a look at the code. Anyway, I'm really enjoying working on this project, so I hope you like my ideas. P.S.: I'm not a Rust expert, my code might not be "rusty" enough, so I'm open to any suggestions :). P.S.2: I'm really starting to get attached to this project. Would you mind if I try to put together a logo and a small website? Of course I plan to open a thread where we can discuss ideas/designs. I'd really like to help spread the word about ETK. Hi Huff, I'm looking at you ;) |
I think the code is ready 🚀 Thanks! Edit: II was confused about the tests that were supposedly wrong. The corrections have already been made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First few comments. Looking reasonable so far! I'm about halfway through asm.rs
.
Thanks! Take your time and don't hesitate to ask questions or correct anything you think can be improved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another partial review. Sorry!
Thank you for your comments @SamWilsn. I just hope I'm not giving you too many headaches haha. P.S: You can take your time on the review, in the meantime I'm finishing PR #135 and, if necessary, I can spend some time on solving some other items on the list of issues in the meantime. |
I missed this part! I'd absolutely love that! There are so many little things I've wanted to build with ETK, and I had basically given up on having the time/motivation to do it. Extremely happy to have someone as excited as you. A website (maybe with an ETK-compiled-to-JavaScript playground 😇) is a great idea! |
Great, glad to be able to help, and to discuss and develop all the ideas you have in mind. I'll prepare a prototype in the next few weeks, including the playground you mention, and I'll write to you to see what you think 😄 |
4cd73c7
to
12c609c
Compare
f9bc8cc
to
3b5d2ac
Compare
… to dynamic push and Sam's comments)
Sorry it's taken me so long to re-review! I believe I found another case that passed before this pull request and is failing now. Thanks again for being so persistent on this. I really appreciate the help getting ETK into a good place <3 |
Sorry, it's also my fault for having to change several parts of the code in the middle of the process and make you check everything again. As I always say, thanks for your patience and for letting me collaborate :) Regarding the code, I solved the case you mention and also added some more tests. The novelty is that now all the pushes are checked and updated taking into account the previous updates (acum variable) (declared_labels is now an ordered structure because it matters the order when adding the accumulated size to the labels). |
Hey @SamWilsn, I needed a HashMap sorted by insert and ended up adding IndexMap to the project. However, it is only used in the assembler and could be replaced by a struct with a HashMap and a Vector if you don't want to add more dependencies. Let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uggh, I found another test case that fails with this approach. I'll push it up in a second. I'm so sorry x.x
I'm totally happy with the |
Pushed the new test. Summary is:
The old code compiled these to the same output, where the new code has different outputs. |
Hey @SamWilsn , how are you? Don't worry about mentioning as many corrections as you deem necessary. After all, this code belongs more to you than to me and I can make all the changes you consider necessary until you are satisfied :). Regarding the bug you reported, I'm sorry I didn't see it before, I understand that with the last change nothing like this should happen again. I look forward to your comments! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just these last two items!
Excellent. Thank you @SamWilsn for your time and patience. Both changes have been made :) |
This PR simplifies the operation of the assembler, mainly by removing the need to maintain a pending state and to return the assembler to its original state in certain situations (which caused issue #124).
The main changes include
Also, issue #124 has been fixed and the corresponding test added.
All tests should pass successfully. However, I would like to test the new assembler a bit more by writing some code (e.g. following @lightclient 's recommendation and writing an ERC-20 implementation using ETK) before merging it.
In case you don't find it necessary, it can be merged right now.