DreamBerd
DreamBerd copied to clipboard
[DRAFT] Make an interpreter for this abomination
putting this here so there's a thread for it, it's not nearly done but if anyone wants to mess with it there's something
the current plan is to write the compiler in python and from there rewrite it in C or Rust, whichever is funnier at the moment or maybe I'll leave it as python that might be cursed enough, idk
For the time travel the way I'm thinking things should work is that execution follows a "cursor", regardless of what timeline that cursor is in. This allows for somewhat deterministic time travel which is pretty cool
Cool git stuff: Resolves #14
The idea with the whole Compinterpreter is to do things in the most convoluted way possible- I want to have it interpret some parts of the code and transpile other parts to another language (maybe multiple based on situation?). I'm kinda indecisive as to what language it should transpile to, I think Javascript is cursed enough to fit the bill but I'm not sure yet
Best of luck to you! Please be careful out there
thanks, so far it hasn't been too crazy, though now that I'm getting to parsing it's gonna be interesting. Is it okay if I make a video on the whole process? I figure it'd be pretty funny and may have some value in showing how to make tokenizers/parsers/etc. I know you have your own channel so I wanna make sure I'm not encroaching on anything you might have in the works
I'm curious to see how you're going to deal with that: AI
@Bytestorm5 Of course! You should go for it, I'd love to see it :)
I'm glad my time travel implementation is actually going to (sorta) become real
For the time travel the way I'm thinking things should work is that execution follows a "cursor", regardless of what timeline that cursor is in. This allows for somewhat deterministic time travel which is pretty cool
Just had a horrible idea inspired by #76 - we store const const const
variables in a cloud database, making DreamBerd the first Always-Online Singleplayer language
we do a small quantity of trolling
const const const delete Date()!
💀
Come to think of it tho someone could probably turn that into an attack vector, maybe injecting code from the cloud into people's computer isn't a good idea lol
const const const
declarations should be reviewed by a team of mods (similarly to the AI feature) I think.
Come to think of it tho someone could probably turn that into an attack vector, maybe injecting code from the cloud into people's computer isn't a good idea lol
Yes in all seriousness, I'd like to implement it in a sandbox'd web version. For a local version, people could connect to their own const const const stores.
Yeah moderation should work- maybe limit it to primitive types as well to prevent any chicanery in terms of infiltrating whatever platform is used to moderate them
Alright so I did some thinking on what needs to happen at a high level because I've kinda hit the limit of "don't think just code," so here's how I think things should work: (This is mostly here for myself bc things are easier for me when I write out my thoughts like this)
File comes in, gets split into however many files are actually in it. Each of those are processed completely independently.
After Tokenizing, the task is to take DreamBerd and turn it into JSX. However JSX is unenlightened and allows for a lot of barbaric practices such as loops- so we have to first make sure the user's code is free of such barbarism with our own syntax check before JavaScript's. This should check things like mutating a const, referencing a variable after its life has ended (if its lifespan is deterministic), etc.
Certain things like ====
can also be handled by the compiler to prevent JavaScript from being JavaScript.
After the syntax is confirmed to be correct with no compilation errors, it is converted to JSX. However there are cases where DreamBerd runtime errors can occur. As such the logical solution is to have many hard-coded templates of error catchers that raise exceptions in case any such issues arise.
Similarly we need to inject some structs to every built file to correctly represent DB Strings, Ints, etc.
Sounds good! Great job so far :D
https://stackoverflow.com/questions/1759987/listening-for-variable-changes-in-javascript https://lage.us/Javascript-Watch-Variables-for-Change.html
Saving this here for later when figuring out the when
control flow
https://chat.openai.com/share/53a01ea6-d655-4b6a-918e-6e13c4e78769
I have decided we are going to have localization for compiler errors, but only for the different dialects of english to achieve true i18n
Hi, I was thinking about doing a similar thing. Have you already thought about a way to handle the past feature, var const(and similar) and this type of stuff? Because in my opinion it would probably be possible to handle them using dictionaries in this way: const var gets transpiled into a function that adds both the entry and the allowed modifications to the dictionary. When it gets updated (in the same way of the when instruction) there is a check against this dictionary to check if the operation is valid. While doing this it saves the old value too. In the same way it would be possible to handle lifetimes too.
If you think this is a good idea I would love to implement it and help you in general with this project
Yeah I had a similar idea in mind- I don't think we're quite at the point of setting up JS since the parser still needs work, but I can add you to the repo so you can contribute.
Do you have a specific version you're following or are you going to add features when they're released?
For now I'm adding features as they come, once the compiler fully encompasses one version of DreamBerd then we can set it up with proper versioning
Ok so hear me out What if instead of having the parser build the js file, we instead have it only check the syntax, and if the syntax is correct it calls some other program entirely to actually convert it into javascript using regex
What if instead of having the parser build the js file, we instead have it only check the syntax, and if the syntax is correct it calls some other program entirely to actually convert it into javascript using regex
Update: This is so cursed I love it
What if instead of having the parser build the js file, we instead have it only check the syntax, and if the syntax is correct it calls some other program entirely to actually convert it into javascript using regex
Update: This is so cursed I love it
lol I can't believe what I just read...
Hey @Odinmylord and/or @Bytestorm5 I really want to demo this at this week's Future of Coding meetup here in London. Either of you up for a video call/chat today? Would love to speak with you about this :)
Cool, I'll be free in the evening
Awesome, pop me a DM anywhere to arrange!
Discord: TodePond#9999 twitter: TodePond mastodon: [email protected]
@TodePond It would have to be rather late today (my time) but I'm down, I'll send you a DM on Discord
Any time tmrw / in the next week, just lmk and I should be able to make time
Since I can't directly DM you on discord I sent you the friend request. I'm Odin#8743
@Bytestorm5 since we are both working on the project but we haven't discussed some details together yet it would be amazing if you could add me on discord at Odin#8743 or contact me on telegram, username: @Odinmylord. So that we can discuss details when needed
@Bytestorm5 since we are both working on the project but we haven't discussed some details together yet it would be amazing if you could add me on discord at Odin#8743 or contact me on telegram, username: @Odinmylord. So that we can discuss details when needed
Ye I'll add you, sent a req