Package: mcdil
MCDIL: McDic's LanguageThis language is created for easy development of Minecraft JE datapack.InstallationYou have to prepare Python 3.11+ to use this library.
After you prepared appropriate environment, run following;pipinstallmcdilFeaturesWIPPrinciples of the Language1. Never trust any value as intermediates other than scoreboard integers and data storages.The list of trustable values during the function execution are following;Scoreboard values.Data storages.Other than the aboves, you should capture everything at the beginning of the function call whatever you need to calculate, and output those at the end of the function. Never refer those during the intermediate calculations.2. Every function execution is atomic.Minecraft ensures that every function execution is an atomic. There are few exceptions like/worldborderthough.
Similar manners are applied in this language.
Every trustable local state should be reliable, even after delay calls.3. Take more memory than sacrificing runtime performance whenever possible.We don't care about the number of functions or duplicated commands here.
If that has much lighter runtime performance, we goes for that.4. A MCDIL function does not guarantee to run code after delay call if the original target entity is killed.Since/scheduledoes not store the information, I introduce a different way to execute various functions in same tick but under different entities.
However, the calling entity must be alive, otherwise the function will not be executed.5. Not every semantics are predictable during runtime, therefore I always consider the worst case.Suppose you conditionally call some delay.
Then the compiler always asssume the delay is always happening, even if there are some cases which does not call delay at all.SpecificationsThis section is incomplete, and always follow the exact grammar specification.
Please readmcdil.larkfor the exact grammar.Built-in TypesNot many primitive types are supported for this moment. I am focusing to make working example first, and then will support floating numbers etc.IntegerUsed with keywordint. Specifically, only 32-bit integers are supported. In most situations, this value is maintained by/scoreboard.int i = 1;
i += 2;BooleanUsed with keywordbool. There are 2 literal keywords for this type;trueandfalse. Likeint, this value is maintained by/scoreboardin most situations.0is considered asfalse, non-zero values are considered astrue.bool b = true;NullThis type is used to indicate only one value - the null. This is similar to C++'svoidor Python'sNone.There is no way to assign anything to this value. Any operator used with null value will fail to compile, exceptnull == nullandnull != null.null n;RangeUsed with keywordrange. For now, only literal ranges are supported for target selectors.Target SelectorUsed with special character@. The syntax is slightly different from Minecraft target selectors.Control FlowsWhile LoopUsed with keywordwhile. This loop is used for typical programming loops.For LoopUsed with keywordas. This loop is specifically used for iterating all entities that fits on given selectors.Example Programdef increment(int x) -> int {
    x += 1;
    return x;
}

def load() -> bool {
    RAW("say Hello everyone!")
};

def tick() -> int {

};