mcdil


Namemcdil JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryMcDic's Language for Minecraft JE Datapack
upload_time2023-12-13 04:12:05
maintainer
docs_urlNone
author
requires_python>=3.11
licenseCopyright 2023 McDic Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords minecraft language compiler
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MCDIL: McDic's Language

This language is created for easy development of Minecraft JE datapack.

## Installation

You have to prepare Python 3.11+ to use this library.
After you prepared appropriate environment, run following;

```bash
pip install mcdil
```

## Features

WIP

# Principles of the Language

### 1. 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 `/worldborder` though.
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 `/schedule` does 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.

# Specifications

This section is incomplete, and always follow the exact grammar specification.
Please read `mcdil.lark` for the exact grammar.

## Built-in Types

Not many primitive types are supported for this moment. I am focusing to make working example first, and then will support floating numbers etc.

### Integer

Used with keyword `int`. Specifically, only 32-bit integers are supported. In most situations, this value is maintained by `/scoreboard`.

```
int i = 1;
i += 2;
```

### Boolean

Used with keyword `bool`. There are 2 literal keywords for this type; `true` and `false`. Like `int`, this value is maintained by `/scoreboard` in most situations. `0` is considered as `false`, non-zero values are considered as `true`.

```
bool b = true;
```

### Null

This type is used to indicate only one value - the null. This is similar to C++'s `void` or Python's `None`.

There is no way to assign anything to this value. Any operator used with null value will fail to compile, except `null == null` and `null != null`.

```
null n;
```

### Range

Used with keyword `range`. For now, only literal ranges are supported for target selectors.

### Target Selector

Used with special character `@`. The syntax is slightly different from Minecraft target selectors.

## Control Flows

### While Loop

Used with keyword `while`. This loop is used for typical programming loops.

### For Loop

Used with keyword `as`. This loop is specifically used for iterating all entities that fits on given selectors.

# Example Program

```
def increment(int x) -> int {
    x += 1;
    return x;
}

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

def tick() -> int {

};
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mcdil",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "minecraft,language,compiler",
    "author": "",
    "author_email": "Minsung Kim <spongbob9876@naver.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/c0/798d5b7d9761680330b27dbf0a811822afd579c36baa5a485730e52813dd/mcdil-0.0.2.tar.gz",
    "platform": null,
    "description": "# MCDIL: McDic's Language\n\nThis language is created for easy development of Minecraft JE datapack.\n\n## Installation\n\nYou have to prepare Python 3.11+ to use this library.\nAfter you prepared appropriate environment, run following;\n\n```bash\npip install mcdil\n```\n\n## Features\n\nWIP\n\n# Principles of the Language\n\n### 1. Never trust any value as intermediates other than scoreboard integers and data storages.\n\nThe list of trustable values during the function execution are following;\n\n- Scoreboard values.\n- Data storages.\n\nOther 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.\n\n### 2. Every function execution is atomic.\n\nMinecraft ensures that every function execution is an atomic. There are few exceptions like `/worldborder` though.\nSimilar manners are applied in this language.\nEvery trustable local state should be reliable, even after delay calls.\n\n### 3. Take more memory than sacrificing runtime performance whenever possible.\n\nWe don't care about the number of functions or duplicated commands here.\nIf that has much lighter runtime performance, we goes for that.\n\n### 4. A MCDIL function does not guarantee to run code after delay call if the original target entity is killed.\n\nSince `/schedule` does not store the information, I introduce a different way to execute various functions in same tick but under different entities.\nHowever, the calling entity must be alive, otherwise the function will not be executed.\n\n### 5. Not every semantics are predictable during runtime, therefore I always consider the worst case.\n\nSuppose you conditionally call some delay.\nThen the compiler always asssume the delay is always happening, even if there are some cases which does not call delay at all.\n\n# Specifications\n\nThis section is incomplete, and always follow the exact grammar specification.\nPlease read `mcdil.lark` for the exact grammar.\n\n## Built-in Types\n\nNot many primitive types are supported for this moment. I am focusing to make working example first, and then will support floating numbers etc.\n\n### Integer\n\nUsed with keyword `int`. Specifically, only 32-bit integers are supported. In most situations, this value is maintained by `/scoreboard`.\n\n```\nint i = 1;\ni += 2;\n```\n\n### Boolean\n\nUsed with keyword `bool`. There are 2 literal keywords for this type; `true` and `false`. Like `int`, this value is maintained by `/scoreboard` in most situations. `0` is considered as `false`, non-zero values are considered as `true`.\n\n```\nbool b = true;\n```\n\n### Null\n\nThis type is used to indicate only one value - the null. This is similar to C++'s `void` or Python's `None`.\n\nThere is no way to assign anything to this value. Any operator used with null value will fail to compile, except `null == null` and `null != null`.\n\n```\nnull n;\n```\n\n### Range\n\nUsed with keyword `range`. For now, only literal ranges are supported for target selectors.\n\n### Target Selector\n\nUsed with special character `@`. The syntax is slightly different from Minecraft target selectors.\n\n## Control Flows\n\n### While Loop\n\nUsed with keyword `while`. This loop is used for typical programming loops.\n\n### For Loop\n\nUsed with keyword `as`. This loop is specifically used for iterating all entities that fits on given selectors.\n\n# Example Program\n\n```\ndef increment(int x) -> int {\n    x += 1;\n    return x;\n}\n\ndef load() -> bool {\n    RAW(\"say Hello everyone!\")\n};\n\ndef tick() -> int {\n\n};\n```\n",
    "bugtrack_url": null,
    "license": "Copyright 2023 McDic  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "McDic's Language for Minecraft JE Datapack",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/McDic/MCDIL"
    },
    "split_keywords": [
        "minecraft",
        "language",
        "compiler"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdd6f46f22e1871ff60d0ba5c6cd40e8ea599d4d395a7e33d4d1e732a8d9bef3",
                "md5": "bd1bc24174cdc9cfd528046d109c1096",
                "sha256": "44f19a3abf0e3a6a2329cb0fd9e133ccc8a2a05ea1a7f7737645a5a9f7cd0311"
            },
            "downloads": -1,
            "filename": "mcdil-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd1bc24174cdc9cfd528046d109c1096",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 8192,
            "upload_time": "2023-12-13T04:12:04",
            "upload_time_iso_8601": "2023-12-13T04:12:04.141462Z",
            "url": "https://files.pythonhosted.org/packages/fd/d6/f46f22e1871ff60d0ba5c6cd40e8ea599d4d395a7e33d4d1e732a8d9bef3/mcdil-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbc0798d5b7d9761680330b27dbf0a811822afd579c36baa5a485730e52813dd",
                "md5": "76bd4377fb22a58745b766bf63698580",
                "sha256": "37306b9a0342564e5c7abae6ad6bfd014cff33510d4e8aee14122183245dc777"
            },
            "downloads": -1,
            "filename": "mcdil-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "76bd4377fb22a58745b766bf63698580",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 8696,
            "upload_time": "2023-12-13T04:12:05",
            "upload_time_iso_8601": "2023-12-13T04:12:05.770802Z",
            "url": "https://files.pythonhosted.org/packages/cb/c0/798d5b7d9761680330b27dbf0a811822afd579c36baa5a485730e52813dd/mcdil-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-13 04:12:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "McDic",
    "github_project": "MCDIL",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "mcdil"
}
        
Elapsed time: 0.15334s