add shulkerscript project

This commit is contained in:
Moritz Hölting 2024-10-01 13:19:12 +02:00
parent c2a07f9394
commit 9954dd0979
2 changed files with 41 additions and 5 deletions

View File

@ -0,0 +1,37 @@
---
title: "Shulkerscript"
summary: "Compiler for Minecraft Datapacks"
date: 2024-10-01
draft: false
tags:
- Rust
demoUrl: https://shulkerscript.hoelting.dev/playground/
repoUrl: https://github.com/moritz-hoelting/shulkerscript-cli
---
## Backstory
Some of my first experiences with programming I had in Minecraft, expanding the game mechanics with my own datapacks. Not long into this, I found a project by [Stevertus](https://stevertus.com), called [mcscript](https://mcscript.stevertus.com).
This provided an abstraction over plain `.mcfunction` files, for example the grouping of execute commands. When I learned about logical operators, I was amazed and thought about what would be possible with this new ability, as it was impractical using plain execute commands that did not offer any operators. But my expectations where crushed soon after as I noticed it had the same pitfalls:
- when using OR, e.g. `A || B`, and both `A` and `B` would be true, the following command would run twice.
- when having multiple commands inside the `if`-block and a former command would falsify the condition, all later commands would not run as the condition was checked for each command individually.
- when using `else` and the condition is true, the `if`-block is executed. a wrong command could lead to the `else`-block being run, too, just like the previous example.
This frustrated me, as I couldn't use the tool for what I wanted. Nevertheless, I used mcscript for all my projects and was really happy with it.
Some time later, after I taught myself some programming, I had the goal to create a better version of this, but it did not go well, as I had no real experience undertaking such a project.
But now, years later, I stumbled upon my old project and felt like now I had a chance of making it work. Even though I am no longer active in the datapack community, I wanted to give back to other people having the same ideas and are missing the tools for it.
## The project
Shulkerscript is a compiler for datapacks. It is written in Rust and compiles multiple `.shu` files into a datapack. It comes with a [cli](https://crates.io/crates/shulkerscript-cli), but can also be compiled to WASM and [run directly in the browser](https://shulkerscript.hoelting.dev/playground).
It allows for multiple function and tag declarations in one file, right where you need them, as well as execute groupings and complex condition combinations. A full overview of the syntax can be found [here](https://shulkerscript.hoelting.dev/guides/syntax/).
The compiler is written without any libraries for tokenizing, parsing and transpiling, and only has third-party dependencies for a better developer experience (like [derive_more](https://crates.io/crates/derive_more), [getset](https://crates.io/crates/getset), [itertools](https://crates.io/crates/itertools), etc.) and for optional [serialization](https://crates.io/crates/serde) and [lua](https://crates.io/crates/mlua) support.
## Thanks
I want to thank Stevertus for the amazing tool he created. Currently, he is working on a framework for datapacks in Dart, called [ObjD](https://objd.stevertus.com/). Take a look if you are interested in that.

View File

@ -15,11 +15,10 @@ repoUrl: https://github.com/studio-nicolehoelting/studio-nicolehoelting
demoUrl: https://nicolehoelting.de
---
This project was the first website I created for the small business of my mother.
This project was the first website I created for my mother's small business.
It started out as me learning HTML and CSS, but soon I was forced to learn Javascript for more intricate animations and buttons.
It started as me learning HTML and CSS, but soon I was forced to learn Javascript for more intricate animations and buttons.
After some years of programming and only coming back to this project only for small changes, I found it tedious to work with
the source code of this website. There were many mistakes from me being new to website creation that I wanted to fix and I was annoyed of changing the same thing in multiple places. Because of this I decided to rewrite everything from scratch in a framework. I choose Next.js for the task and learned React.
After some years of programming and only coming back to this project for small changes, I found it tedious to work with the source code of this website. There were many mistakes from me being new to website creation that I wanted to fix and I was annoyed by changing the same thing in multiple places. Because of this, I decided to rewrite everything from scratch in a framework. I chose Next.js for the task and learned React.
But I was not happy with this, as I thought it was overkill for a static site and only resulted in slower load times. Therefore I decided to migrate to Astro which exactly fit my use case.
However I was not happy with this, as I thought it was overkill for a static site and only resulted in slower load times. Therefore I decided to migrate to Astro which exactly fit my use case.