xdsharp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xdsharp-0.1.0/PKG-INFO +13 -0
- xdsharp-0.1.0/README.md +2 -0
- xdsharp-0.1.0/pyproject.toml +19 -0
- xdsharp-0.1.0/setup.cfg +4 -0
- xdsharp-0.1.0/xdsharp/__init__.py +1 -0
- xdsharp-0.1.0/xdsharp/compiler.py +73 -0
- xdsharp-0.1.0/xdsharp.egg-info/PKG-INFO +13 -0
- xdsharp-0.1.0/xdsharp.egg-info/SOURCES.txt +9 -0
- xdsharp-0.1.0/xdsharp.egg-info/dependency_links.txt +1 -0
- xdsharp-0.1.0/xdsharp.egg-info/entry_points.txt +2 -0
- xdsharp-0.1.0/xdsharp.egg-info/top_level.txt +1 -0
xdsharp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xdsharp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bilingual Arabic/English Transpiler (XD# to C++) for XW Engine
|
|
5
|
+
Author: Amadou Developer
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# XD# Language (XW ENGINE)
|
|
13
|
+
XD# is a bilingual (Arabic & English) high-performance programming language for 2D game development transpiled into C++.
|
xdsharp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xdsharp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [{ name="Amadou Developer" }]
|
|
9
|
+
description = "Bilingual Arabic/English Transpiler (XD# to C++) for XW Engine"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.7"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
xdc = "xdsharp.compiler:main"
|
xdsharp-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .compiler import main
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import sys, os, re
|
|
2
|
+
|
|
3
|
+
def parse_arabic_num(str_num):
|
|
4
|
+
return str_num.translate(str.maketrans("٠١٢٣٤٥٦٧٨٩", "0123456789"))
|
|
5
|
+
|
|
6
|
+
def transpile_xd_to_cpp(xd_code):
|
|
7
|
+
cpp_code = """// === C++ Code generated by XD# Transpiler (XW ENGINE) ===
|
|
8
|
+
#include <iostream>
|
|
9
|
+
#include <string>
|
|
10
|
+
|
|
11
|
+
struct PhysicsWorld {
|
|
12
|
+
float gravity = 9.8f;
|
|
13
|
+
bool isSolidGround = false;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
struct Player {
|
|
17
|
+
std::string name = "Player";
|
|
18
|
+
int health = 100;
|
|
19
|
+
float speed = 10.0f;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
int main() {
|
|
23
|
+
PhysicsWorld world;
|
|
24
|
+
Player player;
|
|
25
|
+
std::cout << "🚀 [XW ENGINE]: Executing XD# Script..." << std::endl;\n"""
|
|
26
|
+
|
|
27
|
+
lines = [line.strip() for line in xd_code.replace('\n', '/').split('/') if line.strip()]
|
|
28
|
+
|
|
29
|
+
for line in lines:
|
|
30
|
+
if "اللاعب_إسمه_" in line or "Player_name_is_" in line:
|
|
31
|
+
name = line.split("_")[-1]
|
|
32
|
+
cpp_code += f' player.name = "{name}";\n'
|
|
33
|
+
elif "صحته_" in line or "health_is_" in line:
|
|
34
|
+
val = parse_arabic_num(re.sub(r'[^0-9٠-٩]', '', line))
|
|
35
|
+
cpp_code += f' player.health = {val};\n'
|
|
36
|
+
elif "سرعة_لاعب_هي(" in line or "player_speed_is(" in line:
|
|
37
|
+
match = re.search(r'\(([^)]+)\)', line)
|
|
38
|
+
if match:
|
|
39
|
+
speed = parse_arabic_num(match.group(1))
|
|
40
|
+
cpp_code += f' player.speed = {speed}.0f;\n'
|
|
41
|
+
elif "الجاذبية_هي(" in line or "gravity_is(" in line:
|
|
42
|
+
match = re.search(r'\(([^)]+)\)', line)
|
|
43
|
+
if match:
|
|
44
|
+
grav = parse_arabic_num(match.group(1))
|
|
45
|
+
cpp_code += f' world.gravity = {grav}f;\n'
|
|
46
|
+
elif line in ["أرض_صلب_لا_إختراق", "solid_ground_no_penetration"]:
|
|
47
|
+
cpp_code += ' world.isSolidGround = true;\n'
|
|
48
|
+
|
|
49
|
+
cpp_code += """ std::cout << "[XD# Output]: Name: " << player.name << " | Health: " << player.health << " | Speed: " << player.speed << std::endl;
|
|
50
|
+
std::cout << "[Physics]: Gravity: " << world.gravity << " | Solid Ground: " << (world.isSolidGround ? "YES" : "NO") << std::endl;
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
"""
|
|
54
|
+
return cpp_code
|
|
55
|
+
|
|
56
|
+
def main():
|
|
57
|
+
if len(sys.argv) < 2:
|
|
58
|
+
print("Usage: xdc <filename.xd>")
|
|
59
|
+
return
|
|
60
|
+
input_file = sys.argv[1]
|
|
61
|
+
if not os.path.exists(input_file):
|
|
62
|
+
print(f"Error: {input_file} not found.")
|
|
63
|
+
return
|
|
64
|
+
with open(input_file, 'r', encoding='utf-8') as f:
|
|
65
|
+
xd_code = f.read()
|
|
66
|
+
cpp_result = transpile_xd_to_cpp(xd_code)
|
|
67
|
+
output_file = input_file.replace('.xd', '.cpp')
|
|
68
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
69
|
+
f.write(cpp_result)
|
|
70
|
+
print(f"✅ Transpiled {input_file} -> {output_file} successfully!")
|
|
71
|
+
|
|
72
|
+
if __name__ == "__main__":
|
|
73
|
+
main()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xdsharp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bilingual Arabic/English Transpiler (XD# to C++) for XW Engine
|
|
5
|
+
Author: Amadou Developer
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# XD# Language (XW ENGINE)
|
|
13
|
+
XD# is a bilingual (Arabic & English) high-performance programming language for 2D game development transpiled into C++.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xdsharp
|