-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
My fork of lit #6
Comments
My dude, @apfeltee, sorry for seeing this almost a month after you've opened the issue.. My life has been... Interesting, to say at the very least :) Incredible work. Huge props for figuring out the internal workings of the whole language. I would really love to merge some of your changes into the main repo, but I have a lot of questions to discuss before that:
As I've said, I really want to get your work into the main repo. But that would mean, probably redoing most of the work again, but this time on the main tree. Are you up to this task? I'm up for collaboration, I have to admit, this project has been paused for a bit due to my IRL stuff, but I really want to finish it and write my next game in it, that's the dream. If you want to reach me faster, hit me up on discord |
Because the changes were already not compatible with upstream by the time I could have forked. It just kinda happened.
Mostly for oneliners a la In the case of javascript, it works ok. Again, the idea is to make it optional, and not to explicitly disallow it.
Well, it get better (or worse, depending on how you look at it): I had started to convert the code to C++ for some pretty good reasons:
But again, that version is so wholly different that I don't expect you to agree with it, but I think that, in order to make Lit more usable, and better optimized, C++ is pretty much the way to go. Here's the link to that version: https://github.com/apfeltee/nlit - be warned though, all the code resides in one file for now. But it's obviously only for now.
That's because there's little sense in keeping the warnings if that particular code never changes. And since
The original parser required them on the same line as their associated keyword. But tbh, I don't recall specifics, I just relaxed that part of the parser.
At least with C, the difference is marginal at best. Unless your device is from the 1980s, this is unlikely to pose an issue. tl;dr i'm probably going to focus on the C++ version for now. It would be easier to port (thanks to builtin standard libraries), won't need |
Do you mean computed gotos? Because I already modified those macros, so that would be chosen if the compiler supports it.
It's similar enough to javascript, without being as huge and unwieldy like v8, quickjs, et cetera... |
No, computed gotos are present in both versions. I mean the whole way the vm operates in terms of how the arguments are passed around. The stack version had a stack, that OPs pushed arguments onto and popped from, now OPs work directly with registers. Also OPs used to be randomly sized, now they all are 4 bytes.
I have to agree here. After a lot of thinking, I have to admit, with all my disgust towards C++, it will be a better option. And that means yet another rewrite... Dang it, this project is already 5+ years old with all the rewrites and so on and so forth, but maybe this will be the last one... Maybe this is the push I need to get more heavy into programming, who knows, with all the bad weather coming, maybe its the spark I need. I will give it a shot. If you would like to join our forces, I welcome you, you've done an amazing job, and we both could really use each other's experience, I think. What's your timezone (I'm in GMT+3)? I would love to have a more real-time chat with you before I sit down and start piling stuff from 0 once again... Cheers, Egor |
Ah, I just looked at the code, and I see what you mean. Might actually be pretty easy to port over.
That's just to order functions context-wise. I think it just makes more sense to define stuff where it is used.
That might not be necessary. Stuff like
I'm not actually sure if I will have that much free time, and at least for me, issues and discussions on github are plenty. Sorry about that... Quick E: I looked at how the register-based vm is implemented, and it differs enough that it would be actually pretty difficult to port over. It would be basically a rewrite at that point - for now, the old vm works (-ish: md5.lit does not produce correct results, and i'm still not sure why). |
I have to admit, the register-based vm was a huge rewrite of the whole code base as it is, and it pretty much means tearing out huge parts of the execution pipeline and rewriting them from 0. |
That is a good thing to be sure, but it's not the most pressing issue atm. I think it might even make more sense to add JIT or AOT, which would implement a register anyway. Personally I'm fine with the VM as it is, but there are clearly some problems that I can't figure out: the file so tl;dr i'd focus on ironing out the runtime, just to make sure that any changes in the compiler/emitter aren't producing bogus instructions. |
You mean the ones used in for loops and stuff like that? It uses variable names that start with a space, so there is no way to access them/create something to replace it with, so it should be fine.
Well yes, but as there are two completely different runtimes at the moment, patching up one doesn't affect the other one. As much as I like how simple the stack based one is in terms of emitting code for it and stuff like that, I'm much more of a fan of the register one overall, since it is much more generalized and easy to extend later on. |
No, in general. Doing
will print
even though
I agree that a register-based VM would be better, but as you had already pointed out, it needs quite a major code overhaul. Hence why I'd put the idea in the backseat for now. |
As I can't quite resolve the as-mentioned-before bug, there's currently no real room (or reason) to continue. |
I've forked lit, though not through github, for reasons that follow:
I've greatly relaxed the parser. I understand that code style is a matter of perspective, but I disagree on forcing a specific style - in this case, that braces are on the same line (i.e.,
if(...) { ...
). now, braces can be on their own line.i've rewritten large parts to make use of sds for strings, which makes string operations faster, but most importantly, easier to use.
implemented
==
explicitly for most primitive types - previously, this was implemented in the VM directly, which caused some odd behaviour when comparing non-numeric values. this isn't complete, but the current impl should give an idea what I mean.reduced headers into a single header. this will seem extreme, but I hope to put lit into a state where it can be included in a projet by plopping the source into a tree with minimal issues. adding to that, fixing a great deal of compiler warnings.
rewrote the bits that are compiler-dependant, so that lit, for example, can now be compiled with visualstudio, tinycc, etc. stuff like dynamic C arrays are a GNU extension, and I removed them, or replaced them with explicit allocations.
Since I've currently cared more about features, the testing framework is uh, kinda sorta not there anymore. But if you can
./run
files likemandel.lit
, or anything in./examples/
, then that's as good as sanity testing goes right now. This is something i'm definitely working on, ideally without 3rdparty deps.All in all, I've ironed out lit to the point where there are zero issues in valgrind, etc. No mem leaks. Memory usage is approx. the same as upstream. It compiles cleanly.
But most of these changes aren't compatible with your upstream, so I'd like to know what you think! Maybe we'll come to some understanding.
The text was updated successfully, but these errors were encountered: