solpl 2.0.0__tar.gz → 2.2.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.
- solpl-2.2.0/PKG-INFO +7 -0
- {solpl-2.0.0 → solpl-2.2.0}/interpreter/sol.py +34 -17
- solpl-2.2.0/pyproject.toml +15 -0
- solpl-2.2.0/solpl.egg-info/PKG-INFO +7 -0
- solpl-2.0.0/PKG-INFO +0 -59
- solpl-2.0.0/pyproject.toml +0 -22
- solpl-2.0.0/solpl.egg-info/PKG-INFO +0 -59
- {solpl-2.0.0 → solpl-2.2.0}/LICENSE +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/README.md +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/setup.cfg +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/solpl.egg-info/SOURCES.txt +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/solpl.egg-info/dependency_links.txt +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/solpl.egg-info/entry_points.txt +0 -0
- {solpl-2.0.0 → solpl-2.2.0}/solpl.egg-info/top_level.txt +0 -0
solpl-2.2.0/PKG-INFO
ADDED
|
@@ -3,7 +3,7 @@ import threading
|
|
|
3
3
|
import time
|
|
4
4
|
import sys
|
|
5
5
|
import os
|
|
6
|
-
import urllib.request
|
|
6
|
+
import urllib.request
|
|
7
7
|
import http.server
|
|
8
8
|
|
|
9
9
|
class ReturnSignal(Exception):
|
|
@@ -27,16 +27,28 @@ class SolInterpreter:
|
|
|
27
27
|
|
|
28
28
|
def _compute(self, expr):
|
|
29
29
|
expr = str(expr).strip()
|
|
30
|
+
|
|
31
|
+
if "+" in expr and any(c.isalpha() or c in ['"', "'"] for c in expr):
|
|
32
|
+
parts = expr.split("+")
|
|
33
|
+
result = ""
|
|
34
|
+
for p in parts:
|
|
35
|
+
val = str(self._resolve(p.strip()))
|
|
36
|
+
result += val
|
|
37
|
+
return result
|
|
38
|
+
|
|
30
39
|
ops = ['+', '-', '*', ':']
|
|
31
40
|
for op in ops:
|
|
32
41
|
if op in expr:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
try:
|
|
43
|
+
left, right = expr.split(op, 1)
|
|
44
|
+
val1 = float(self._resolve(left))
|
|
45
|
+
val2 = float(self._resolve(right))
|
|
46
|
+
if op == '+': return val1 + val2
|
|
47
|
+
if op == '-': return val1 - val2
|
|
48
|
+
if op == '*': return val1 * val2
|
|
49
|
+
if op == ':': return val1 / val2
|
|
50
|
+
except ValueError:
|
|
51
|
+
continue
|
|
40
52
|
return self._resolve(expr)
|
|
41
53
|
|
|
42
54
|
def _lookup(self, name):
|
|
@@ -51,7 +63,6 @@ class SolInterpreter:
|
|
|
51
63
|
def _resolve(self, val):
|
|
52
64
|
val = str(val).strip()
|
|
53
65
|
|
|
54
|
-
# Handle built-in native functions
|
|
55
66
|
if val.startswith("_fetch(") and val.endswith(")"):
|
|
56
67
|
url_expr = val[7:-1].strip()
|
|
57
68
|
url = str(self._compute(url_expr))
|
|
@@ -74,13 +85,12 @@ class SolInterpreter:
|
|
|
74
85
|
return container[idx]
|
|
75
86
|
except (ValueError, IndexError, KeyError): pass
|
|
76
87
|
if "." in val:
|
|
77
|
-
obj_name, prop = val.split(".")
|
|
88
|
+
obj_name, prop = val.split(".", 1)
|
|
78
89
|
obj = self._lookup(obj_name)
|
|
79
90
|
if isinstance(obj, dict):
|
|
80
91
|
return obj.get(prop, 0)
|
|
81
92
|
|
|
82
93
|
existing_val = self._lookup(val)
|
|
83
|
-
if Carlsbad_val := self._lookup(val): return Carlsbad_val
|
|
84
94
|
if existing_val is not None: return existing_val
|
|
85
95
|
try: return float(val) if '.' in val else int(val)
|
|
86
96
|
except: return val.replace('"', '').replace("'", "")
|
|
@@ -101,7 +111,8 @@ class SolInterpreter:
|
|
|
101
111
|
def _native_fetch(self, url):
|
|
102
112
|
try:
|
|
103
113
|
with urllib.request.urlopen(url, timeout=5) as response:
|
|
104
|
-
|
|
114
|
+
# Fix: Added errors='replace' to handle non-UTF-8 bytes safely
|
|
115
|
+
return response.read().decode('utf-8', errors='replace')
|
|
105
116
|
except Exception as e:
|
|
106
117
|
return f"Error fetching URL: {str(e)}"
|
|
107
118
|
|
|
@@ -224,7 +235,6 @@ class SolInterpreter:
|
|
|
224
235
|
return return_value
|
|
225
236
|
|
|
226
237
|
def _execute_line(self, line):
|
|
227
|
-
# Pipeline Check for Asynchronous Custom Prompts: "Name: " >> _input >> a
|
|
228
238
|
if ">>" in line and "_input" in line:
|
|
229
239
|
parts = [p.strip() for p in line.split(">>")]
|
|
230
240
|
if len(parts) == 3 and parts[1] == "_input":
|
|
@@ -252,9 +262,16 @@ class SolInterpreter:
|
|
|
252
262
|
t.start()
|
|
253
263
|
self.threads.append(t)
|
|
254
264
|
|
|
255
|
-
elif line.startswith("_in
|
|
256
|
-
|
|
257
|
-
|
|
265
|
+
elif line.startswith("_in"):
|
|
266
|
+
if "(" in line and ")" in line:
|
|
267
|
+
parts = line.split("(")
|
|
268
|
+
prompt = parts[1].split(")")[0].strip().replace('"', '').replace("'", "")
|
|
269
|
+
var_name = line.split("->")[1].strip()
|
|
270
|
+
else:
|
|
271
|
+
var_name = line.split("->")[1].strip()
|
|
272
|
+
prompt = f"[INPUT REQUIRED FOR %s]: " % var_name
|
|
273
|
+
|
|
274
|
+
user_val = input(prompt + " ")
|
|
258
275
|
try:
|
|
259
276
|
if '.' in user_val: user_val = float(user_val)
|
|
260
277
|
else: user_val = int(user_val)
|
|
@@ -289,7 +306,7 @@ class SolInterpreter:
|
|
|
289
306
|
elif "->" in line:
|
|
290
307
|
var, val = [x.strip() for x in line.split("->")]
|
|
291
308
|
if "." in var:
|
|
292
|
-
obj, prop = var.split(".")
|
|
309
|
+
obj, prop = var.split(".", 1)
|
|
293
310
|
target_obj = self._lookup(obj)
|
|
294
311
|
if isinstance(target_obj, dict):
|
|
295
312
|
target_obj[prop] = self._compute(val)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "solpl"
|
|
7
|
+
version = "2.2.0"
|
|
8
|
+
description = "Sol Programming Language Interpreter"
|
|
9
|
+
requires-python = ">=3.7"
|
|
10
|
+
|
|
11
|
+
[project.scripts]
|
|
12
|
+
solpl = "interpreter.sol:main"
|
|
13
|
+
|
|
14
|
+
[tool.setuptools]
|
|
15
|
+
packages = ["interpreter"]
|
solpl-2.0.0/PKG-INFO
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: solpl
|
|
3
|
-
Version: 2.0.0
|
|
4
|
-
Summary: A lightweight, multi-threaded interpreter for the Sol programming language.
|
|
5
|
-
Author-email: Your Name <your.email@example.com>
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
|
-
# Sol
|
|
16
|
-
Sol is an interpreted language built with Python, originally designed to handle async operations only, but has expanded to a full scripting language.
|
|
17
|
-
|
|
18
|
-
# Why did I build Sol?
|
|
19
|
-
|
|
20
|
-
I needed something fast, that handled async natively, and which had very few keywords. Then came my first prototype, which only supported async functions. Sol now supports everything a programming language should need: Functions, variables, I/O, etc.
|
|
21
|
-
|
|
22
|
-
# How to install Sol?
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
pip install solpl
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
# How to run a Sol script?
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
solpl FILENAME.sol
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
# Example:
|
|
35
|
-
|
|
36
|
-
This demonstrates Sol's capabilities with async:
|
|
37
|
-
|
|
38
|
-
```lua
|
|
39
|
-
countDown(taskName, maxCount)
|
|
40
|
-
for i -> 1 to maxCount
|
|
41
|
-
_out -> taskName
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
main()
|
|
46
|
-
_out -> 111
|
|
47
|
-
countDown(777, 4) >> _async
|
|
48
|
-
countDown(999, 4) >> _async
|
|
49
|
-
_out -> 222
|
|
50
|
-
end
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
# License
|
|
54
|
-
|
|
55
|
-
This repository is licensed with Apache License 2.0, see the LICENSE file for more details
|
|
56
|
-
|
|
57
|
-
# Link to PyPi package:
|
|
58
|
-
|
|
59
|
-
https://pypi.org/project/solpl/
|
solpl-2.0.0/pyproject.toml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "solpl"
|
|
7
|
-
version = "2.0.0"
|
|
8
|
-
authors = [
|
|
9
|
-
{ name="Your Name", email="your.email@example.com" }
|
|
10
|
-
]
|
|
11
|
-
description = "A lightweight, multi-threaded interpreter for the Sol programming language."
|
|
12
|
-
readme = "README.md"
|
|
13
|
-
license = {text = "Apache-2.0"}
|
|
14
|
-
requires-python = ">=3.7"
|
|
15
|
-
classifiers = [
|
|
16
|
-
"Programming Language :: Python :: 3",
|
|
17
|
-
"License :: OSI Approved :: Apache Software License",
|
|
18
|
-
"Operating System :: OS Independent",
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
[project.scripts]
|
|
22
|
-
solpl = "interpreter.sol:main"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: solpl
|
|
3
|
-
Version: 2.0.0
|
|
4
|
-
Summary: A lightweight, multi-threaded interpreter for the Sol programming language.
|
|
5
|
-
Author-email: Your Name <your.email@example.com>
|
|
6
|
-
License: Apache-2.0
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Dynamic: license-file
|
|
14
|
-
|
|
15
|
-
# Sol
|
|
16
|
-
Sol is an interpreted language built with Python, originally designed to handle async operations only, but has expanded to a full scripting language.
|
|
17
|
-
|
|
18
|
-
# Why did I build Sol?
|
|
19
|
-
|
|
20
|
-
I needed something fast, that handled async natively, and which had very few keywords. Then came my first prototype, which only supported async functions. Sol now supports everything a programming language should need: Functions, variables, I/O, etc.
|
|
21
|
-
|
|
22
|
-
# How to install Sol?
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
pip install solpl
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
# How to run a Sol script?
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
solpl FILENAME.sol
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
# Example:
|
|
35
|
-
|
|
36
|
-
This demonstrates Sol's capabilities with async:
|
|
37
|
-
|
|
38
|
-
```lua
|
|
39
|
-
countDown(taskName, maxCount)
|
|
40
|
-
for i -> 1 to maxCount
|
|
41
|
-
_out -> taskName
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
main()
|
|
46
|
-
_out -> 111
|
|
47
|
-
countDown(777, 4) >> _async
|
|
48
|
-
countDown(999, 4) >> _async
|
|
49
|
-
_out -> 222
|
|
50
|
-
end
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
# License
|
|
54
|
-
|
|
55
|
-
This repository is licensed with Apache License 2.0, see the LICENSE file for more details
|
|
56
|
-
|
|
57
|
-
# Link to PyPi package:
|
|
58
|
-
|
|
59
|
-
https://pypi.org/project/solpl/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|