txtsharp 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.
txtsharp-0.1.0/LICENSE ADDED
File without changes
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: txtsharp
3
+ Version: 0.1.0
4
+ Summary: T# - Fully English text-based programming language
5
+ Author-email: Intel <your@email.com>
6
+ Keywords: T#,txtsharp,English programming,text-based language
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # T# — Fully English Text-Based Programming Language
16
+
17
+ T# is an ultra-simple, beginner-friendly programming language where all commands are fully readable in English. Programs use the `.tsh` file extension.
18
+
19
+ ---
20
+
21
+ ## Features
22
+
23
+ - English-style commands
24
+ - Variables and assignment
25
+ - Input from user
26
+ - Math operations (`add`, `subtract`, `multiply`, `divide`)
27
+ - Print output
28
+ - Comments (`# this is a comment`)
29
+
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ Install via PyPI:
35
+
36
+ ```bash
37
+ pip install txtsharp
38
+ ```
39
+
@@ -0,0 +1,25 @@
1
+ # T# — Fully English Text-Based Programming Language
2
+
3
+ T# is an ultra-simple, beginner-friendly programming language where all commands are fully readable in English. Programs use the `.tsh` file extension.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - English-style commands
10
+ - Variables and assignment
11
+ - Input from user
12
+ - Math operations (`add`, `subtract`, `multiply`, `divide`)
13
+ - Print output
14
+ - Comments (`# this is a comment`)
15
+
16
+ ---
17
+
18
+ ## Installation
19
+
20
+ Install via PyPI:
21
+
22
+ ```bash
23
+ pip install txtsharp
24
+ ```
25
+
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=65.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "txtsharp"
7
+ version = "0.1.0"
8
+ description = "T# - Fully English text-based programming language"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ { name = "Intel", email = "your@email.com" }
13
+ ]
14
+ license = { file = "LICENSE" }
15
+ keywords = ["T#", "txtsharp", "English programming", "text-based language"]
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent"
20
+ ]
21
+
22
+ [project.scripts]
23
+ txtsharp = "txtsharp.cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ # __init__.py
2
+ from .core import Tsharp
3
+
4
+ __version__ = "0.1.0"
@@ -0,0 +1,18 @@
1
+ # cli.py
2
+ import sys
3
+ from .core import Tsharp
4
+
5
+ def main():
6
+ if len(sys.argv) < 2:
7
+ print("Usage: txtsharp <file.tsh>")
8
+ sys.exit(1)
9
+
10
+ filename = sys.argv[1]
11
+ if not filename.endswith(".tsh"):
12
+ print("Error: T# files must have a .tsh extension")
13
+ sys.exit(1)
14
+
15
+ Tsharp().run_file(filename)
16
+
17
+ if __name__ == "__main__":
18
+ main()
@@ -0,0 +1,86 @@
1
+ # core.py
2
+ class Tsharp:
3
+ def __init__(self):
4
+ self.vars = {}
5
+
6
+ def get_var(self, name):
7
+ return self.vars.get(name, 0)
8
+
9
+ def set_var(self, name, value):
10
+ self.vars[name] = value
11
+
12
+ def eval_value(self, value):
13
+ value = value.strip()
14
+ # Number check
15
+ if value.replace(".", "", 1).isdigit():
16
+ if "." in value:
17
+ return float(value)
18
+ return int(value)
19
+ # Known variable
20
+ if value in self.vars:
21
+ return self.vars[value]
22
+ # Text fallback
23
+ return value
24
+
25
+ def run_line(self, line):
26
+ line = line.strip()
27
+ if not line or line.startswith("#"):
28
+ return
29
+
30
+ # SET <variable> TO <value>
31
+ if line.lower().startswith("set "):
32
+ parts = line[4:].split(" to ", 1)
33
+ if len(parts) == 2:
34
+ var_name = parts[0].strip()
35
+ value = self.eval_value(parts[1])
36
+ self.set_var(var_name, value)
37
+ else:
38
+ print(f"Invalid set command: {line}")
39
+ return
40
+
41
+ # SHOW <value/variable>
42
+ if line.lower().startswith("show "):
43
+ value = self.eval_value(line[5:])
44
+ print(value)
45
+ return
46
+
47
+ # ASK <variable> (input)
48
+ if line.lower().startswith("ask "):
49
+ var_name = line[4:].strip()
50
+ self.set_var(var_name, input(f"{var_name}: "))
51
+ return
52
+
53
+ # Math commands: add/subtract/multiply/divide
54
+ words = line.lower().split()
55
+ if words[0] in ["add", "subtract", "multiply", "divide"]:
56
+ if "to" in words:
57
+ idx = words.index("to")
58
+ num = self.eval_value(" ".join(words[1:idx]))
59
+ var = " ".join(words[idx+1:])
60
+ self.set_var(var, self.get_var(var) + num)
61
+ return
62
+ elif "from" in words:
63
+ idx = words.index("from")
64
+ num = self.eval_value(" ".join(words[1:idx]))
65
+ var = " ".join(words[idx+1:])
66
+ self.set_var(var, self.get_var(var) - num)
67
+ return
68
+ elif "by" in words:
69
+ idx = words.index("by")
70
+ num = self.eval_value(" ".join(words[1:idx]))
71
+ var = " ".join(words[idx+1:])
72
+ if words[0] == "multiply":
73
+ self.set_var(var, self.get_var(var) * num)
74
+ elif words[0] == "divide":
75
+ self.set_var(var, self.get_var(var) / num)
76
+ return
77
+
78
+ print(f"Unknown command: {line}")
79
+
80
+ def run_file(self, filename):
81
+ try:
82
+ with open(filename, "r") as f:
83
+ for line in f:
84
+ self.run_line(line)
85
+ except FileNotFoundError:
86
+ print(f"File {filename} not found.")
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: txtsharp
3
+ Version: 0.1.0
4
+ Summary: T# - Fully English text-based programming language
5
+ Author-email: Intel <your@email.com>
6
+ Keywords: T#,txtsharp,English programming,text-based language
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # T# — Fully English Text-Based Programming Language
16
+
17
+ T# is an ultra-simple, beginner-friendly programming language where all commands are fully readable in English. Programs use the `.tsh` file extension.
18
+
19
+ ---
20
+
21
+ ## Features
22
+
23
+ - English-style commands
24
+ - Variables and assignment
25
+ - Input from user
26
+ - Math operations (`add`, `subtract`, `multiply`, `divide`)
27
+ - Print output
28
+ - Comments (`# this is a comment`)
29
+
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ Install via PyPI:
35
+
36
+ ```bash
37
+ pip install txtsharp
38
+ ```
39
+
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ txtsharp/__init__.py
5
+ txtsharp/cli.py
6
+ txtsharp/core.py
7
+ txtsharp.egg-info/PKG-INFO
8
+ txtsharp.egg-info/SOURCES.txt
9
+ txtsharp.egg-info/dependency_links.txt
10
+ txtsharp.egg-info/entry_points.txt
11
+ txtsharp.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ txtsharp = txtsharp.cli:main
@@ -0,0 +1 @@
1
+ txtsharp