Released a cli tool "gdscript-transpiler-bin" which translates basic gdscript files to python

Python code can later be compiled into a standalone executable

https://linuxusergd.itch.io/gdscript-transpiler-bin

Source code: https://codeberg.org/LinuxUserGD/gdscript-transpiler-bin

#GodotEngine #GodotCommunityDE #MadeWithGodot #Python

@HugeGameArtGD Pretty cool. What's the use-case for this?

Search and replace isn't a scalable option (it gets hairy really fast). A better option would be to build a parse tree, This old project of mine might be helpful: https://github.com/nightblade9/dragon

GitHub - nightblade9/dragon: Dragon is a universal Python translater.

Dragon is a universal Python translater. Contribute to nightblade9/dragon development by creating an account on GitHub.

GitHub
@nightblade9 Thanks, the use-case is a standalone GDScript compiler that runs GDScript projects slightly faster and doesn't require the Godot Engine, e. g. for reimplementing small algorithms in GDScript.
I tried to write a simple tokenizer to transpile scripts instead of search-and-replace, though I can't use lark directly as it's too difficult to rewrite it in gdscript.
https://github.com/MikeSchulze/gdUnit4/blob/master/addons/gdUnit4/src/core/parse/GdScriptParser.gd
The GDUnit Project uses a parser for unit tests which would also work for a transpiler I think.
gdUnit4/GdScriptParser.gd at master · MikeSchulze/gdUnit4

A Godot Unit Test Framework. Support for GDScript and C# unit testing - gdUnit4/GdScriptParser.gd at master · MikeSchulze/gdUnit4

GitHub
@HugeGameArtGD @nightblade9 So it's useful if I wrote a general algorithm in GDScript and I want to reuse it in Python, for instance?

@leyn @nightblade9 Yes, because it should be easier to write optimized GDScript (which can be compiled AOT even if variables are not statically typed) than writing Python or cross-platform C code.

Could also be used in Python projects (e. g. by uploading transpiled code to PyPi, and possibly(?) run with godot-python as an external package).