{"id":19901193,"url":"https://github.com/rbaltrusch/natscript","last_synced_at":"2025-09-12T03:03:58.208Z","repository":{"id":50387032,"uuid":"314796344","full_name":"rbaltrusch/natscript","owner":"rbaltrusch","description":"The Natscript interpreter, a custom programming language, with a natural English-like syntax.","archived":false,"fork":false,"pushed_at":"2025-08-16T11:00:40.000Z","size":314,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-16T13:30:41.796Z","etag":null,"topics":["custom-interpreted-language","custom-language","interpreter","language","natscript","programming-language","programming-languages","python-interpreter","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbaltrusch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-21T11:30:22.000Z","updated_at":"2025-08-16T11:00:37.000Z","dependencies_parsed_at":"2025-05-02T23:31:39.254Z","dependency_job_id":"d96e9a62-b609-4712-a933-b30728a88091","html_url":"https://github.com/rbaltrusch/natscript","commit_stats":null,"previous_names":["rbaltrusch/natscript"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rbaltrusch/natscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fnatscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fnatscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fnatscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fnatscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbaltrusch","download_url":"https://codeload.github.com/rbaltrusch/natscript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbaltrusch%2Fnatscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274746948,"owners_count":25341766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["custom-interpreted-language","custom-language","interpreter","language","natscript","programming-language","programming-languages","python-interpreter","python3"],"created_at":"2024-11-12T20:14:20.735Z","updated_at":"2025-09-12T03:03:58.154Z","avatar_url":"https://github.com/rbaltrusch.png","language":"Python","readme":"[![Unit tests](https://github.com/rbaltrusch/natscript/actions/workflows/pytest-unit-tests.yml/badge.svg)](https://github.com/rbaltrusch/natscript/actions/workflows/pytest-unit-tests.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n\n# Natscript Interpreter\n\nThis is Natscript, a custom cross-platform, dynamic interpreted language with a free, natural language-like syntax that lends itself to prosaic code, such as:\n\n```powershell\ndefine function main as {\n    set squares to []\n    for each number in range from 0 to 5 not equal to 3 {\n        multiply it by itself, then append it to squares\n    }\n    return squares\n}\n\n# This will output [0, 1, 4, 16] to the console\nprint result of call main\n```\n\nThe main implementation of the Natscript interpreter is currently written in Python, but may be shifted to [C++](https://github.com/rbaltrusch/natscript/tree/main/README.md#c-implementation) in the future for improved performance.\n\n## Available functionality\n\nCurrently available functionality includes:\n- variables and operations\n- conditionals\n- loops (for-each, while)\n- first-order functions\n- module declarations and imports\n- access modifiers (private, constant)\n- recursion\n- a bytecode compiler to speed up module loading\n- precise stack traces for run-time exceptions\n\nLanguage documentation can be found in the [doc](https://github.com/rbaltrusch/natscript/tree/main/doc) folder.\n\n## Getting started\n\nTo get a copy of this repository, clone it using git, then install all dependencies (currently none), as well as the natscript package itself:\n\n```batch\ngit clone https://github.com/rbaltrusch/natscript\ncd natscript\npython -m pip install -r requirements.txt\npython -m pip install -e .\n```\n\nTo run the interpreter, run the natscript Python package, specifying a Natscript file to be executed, or nothing to enter an interactive shell session:\n```batch\npython -m natscript\npython -m natscript doc\\examples\\helloworld.nat\n```\n\n## Syntax highlighting\n\n### Github / Linguist\n\nCurrently, Natscript is in its early stages and not supported yet by Linguist (which, e.g. provides the syntax highlighting on Github). Powershell syntax highlighting seems to be an acceptable alternative.\n\n### Visual Studio Code\n\nLanguage support in VS Code is in work, but not available yet. An early-stage VS Code extension with static syntax highlighting can be found [here](https://github.com/rbaltrusch/natscript-vscode), but at the moment needs to be manually added to the VS Code extensions folder.\n\n### Notepad++\n\nThe syntax highlighting file for Natscript in Notepad++ can be found [here](https://github.com/rbaltrusch/natscript/tree/main/tools/syntax_highlighting/notepad++/natscript.xml). It can be imported to Notepad++ in the Languages menu (Languages -\u003e User Language -\u003e Define Your Language... -\u003e Import).\n\n## Documentation\n\nLanguage documentation, including examples and tutorials, can be found in the [doc](https://github.com/rbaltrusch/natscript/tree/main/doc) folder. It is currently a work in progress.\n\n### Examples\n\nBelow is one example of the natural syntax of Natscript:\n\n```powershell\ndefine function fibonacci expecting [limit] as {\n    set old to 1\n    set current to 1\n    set numbers to [old current]\n\n    while checked that current is less than the limit {\n        set temp to current\n        add old to current then set old to temp\n        append current to numbers\n    }\n    return the numbers\n}\n\ndefine function main as {\n    return result of call fibonacci with [1000000]\n}\n\n# prints all fibonacci numbers from 1 to 1000000\ncall main and print result\n```\n\nA full list of code examples can be found [here](https://github.com/rbaltrusch/natscript/tree/main/doc/examples).\n\n### Tutorials\n\nTutorials can be found in the [doc](https://github.com/rbaltrusch/natscript/tree/main/doc) folder.\n\n### Interpreter CLI\n\nThe Natscript interpreter CLI has several configureable options:\n\n```\nusage: natscript [-h] [--debug] [--compile COMPILE] [--compiled-format {pickle,json}]\n                             [--iterations ITERATIONS]\n                             filepath\n\nCLI for the Natscript interpreter\n\npositional arguments:\n  filepath              The path of the Natscript file to be run\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --debug, -d           Enables the interpreter debug mode\n  --compile COMPILE, -c COMPILE\n                        Enables the bytecode compiler\n  --compiled-format {pickle,json}, -f {pickle,json}\n                        Specifies the format of the bytecode-compiled file\n  --iterations ITERATIONS, -i ITERATIONS\n                        Specifies how often the script should be executed\n```\n\nThe interpreter CLI help message can be shown by running:\n```batch\npython -m natscript -h\n```\n\n## Pyinstaller\n\nPackaging the interpreter using pyinstaller can speed up execution time of Natscript code by a factor of 2x. Simply bundle it using the command:\n\n```batch\npyinstaller -n natscript natscript/__main__.py\n```\n\nThis will generate an executable file called natscript.exe (with the same CLI as the python package) in the dist/natscript folder.\n\n## C++ Implementation\n\nThe C++ implementation (work in progress) of the Natscript interpreter can be found [here](https://github.com/rbaltrusch/cpp-natscript). This may be abandoned in the future in favour of LLVM-based JIT acceleration for the Python implementation of Natscript.\n\n## Contributions\n\nContributions are welcome! For more details, please read the [contribution guidelines](CONTRIBUTING.md).\n\n## Python\n\nWritten in Python 3.8.3.\n\n## License\n\nThis repository is open-source software available under the [MIT license](https://github.com/rbaltrusch/natscript/blob/main/LICENSE).\n\n## Contact\n\nPlease raise an issue for code changes. To reach out, please send an email to richard@baltrusch.net.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaltrusch%2Fnatscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbaltrusch%2Fnatscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbaltrusch%2Fnatscript/lists"}