DPScript
- 3 Devlogs
- 15 Total hours
A programming language for Minecraft datapacks, inspired by SethBling's CBScript and Rust.
A programming language for Minecraft datapacks, inspired by SethBling's CBScript and Rust.
Oh boy this is gonna be something, it’ll be fun though.
Major problem is analysis - lexical analysis is a tough nut to crack, especially with a language that relies on syntactic sugar as much as this one does. Minecraft doesn’t support many operations natively, so EVERYTHING has to be simplified in weird ways which creates a ton of things I have to end up doing in my analyzer. :/
The attached screenshot is my WIP type inference analyzer, and it is a freaking chonker. There’s a lot of little things to consider - #[repr] metadata, struct layout, types, all of that goes into figuring out what a type even is for a value.
I decided to end up typing the values in-AST by using the &mut reference passed into the visitor (replacing the original node in memory), but I might change the approach later.
I’m also not sure if doing inference before desugaring is a good idea, but only one way to find out, I guess.
Crazy debugging tactics right here
I’m working on the new analysis engine at this point. The lexer and tokenizer are fully functional, and what’s needed now is type checking, inference, location/ID resolution, and the actual compilation to Minecraft function code.
This will likely end up compiling down to a custom IR AST, which will make the final compilation down to mcfunction much easier, since it won’t have all the abstractions needed for the whole language’s features. Plus, it might help with simulation of values for debugging, too.
It’s gonna be a long journey from here, but it’ll be worth it!