syntactical 1.2.1__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.
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: syntactical
3
+ Version: 1.2.1
4
+ Requires-Dist: asgiref==3.11.1
5
+ Requires-Dist: blinker==1.9.0
6
+ Requires-Dist: certifi==2026.1.4
7
+ Requires-Dist: cffi==2.0.0
8
+ Requires-Dist: charset-normalizer==3.4.4
9
+ Requires-Dist: click==8.3.1
10
+ Requires-Dist: colorama==0.4.6
11
+ Requires-Dist: contourpy==1.3.3
12
+ Requires-Dist: cryptography==46.0.4
13
+ Requires-Dist: cycler==0.12.1
14
+ Requires-Dist: Django==6.0.2
15
+ Requires-Dist: docutils==0.22.4
16
+ Requires-Dist: Flask==3.1.2
17
+ Requires-Dist: fonttools==4.61.1
18
+ Requires-Dist: id==1.6.1
19
+ Requires-Dist: idna==3.11
20
+ Requires-Dist: itsdangerous==2.2.0
21
+ Requires-Dist: jaraco.classes==3.4.0
22
+ Requires-Dist: jaraco.context==6.1.0
23
+ Requires-Dist: jaraco.functools==4.4.0
24
+ Requires-Dist: Jinja2==3.1.6
25
+ Requires-Dist: keyboard==0.13.5
26
+ Requires-Dist: keyring==25.7.0
27
+ Requires-Dist: kiwisolver==1.4.9
28
+ Requires-Dist: lark==1.3.1
29
+ Requires-Dist: markdown-it-py==4.0.0
30
+ Requires-Dist: MarkupSafe==3.0.3
31
+ Requires-Dist: matplotlib==3.10.8
32
+ Requires-Dist: mdurl==0.1.2
33
+ Requires-Dist: more-itertools==10.8.0
34
+ Requires-Dist: nh3==0.3.2
35
+ Requires-Dist: numpy==2.4.2
36
+ Requires-Dist: packaging==26.0
37
+ Requires-Dist: pathlib==1.0.1
38
+ Requires-Dist: pick==2.4.0
39
+ Requires-Dist: pillow==12.1.0
40
+ Requires-Dist: pycparser==3.0
41
+ Requires-Dist: pygame==2.6.1
42
+ Requires-Dist: Pygments==2.19.2
43
+ Requires-Dist: pynput==1.8.1
44
+ Requires-Dist: pyparsing==3.3.2
45
+ Requires-Dist: python-dateutil==2.9.0.post
46
+ Requires-Dist: pywin32-ctypes==0.2.3
47
+ Requires-Dist: readme_renderer==44.0
48
+ Requires-Dist: requests==2.32.5
49
+ Requires-Dist: requests-toolbelt==1.0.0
50
+ Requires-Dist: rfc3986==2.0.0
51
+ Requires-Dist: rich==14.3.2
52
+ Requires-Dist: setuptools==82.0.0
53
+ Requires-Dist: six==1.17.0
54
+ Requires-Dist: sqlparse==0.5.5
55
+ Requires-Dist: twine==6.2.0
56
+ Requires-Dist: tzdata==2025.3
57
+ Requires-Dist: urllib3==2.6.3
58
+ Requires-Dist: Werkzeug==3.1.5
59
+ Requires-Dist: wheel==0.46.3
60
+ Requires-Dist: windows-curses==2.4.1
@@ -0,0 +1,11 @@
1
+ # Syntactical
2
+
3
+ **_The programing language of the future._**
4
+
5
+ ### What is Syntactical?
6
+
7
+ Syntactical is a programming language made with Python, that is meant to be like Python, but with better syntax.
8
+
9
+ ### Documentation
10
+
11
+ Documentation is under construction. The current documentation can be found [here](https://github.com/thecoolguy62aws/syntactical/wiki).
@@ -0,0 +1,71 @@
1
+ [project]
2
+ name = "syntactical"
3
+ version = "1.2.1"
4
+ dependencies = [
5
+ "asgiref==3.11.1",
6
+ "blinker==1.9.0",
7
+ "certifi==2026.1.4",
8
+ "cffi==2.0.0",
9
+ "charset-normalizer==3.4.4",
10
+ "click==8.3.1",
11
+ "colorama==0.4.6",
12
+ "contourpy==1.3.3",
13
+ "cryptography==46.0.4",
14
+ "cycler==0.12.1",
15
+ "Django==6.0.2",
16
+ "docutils==0.22.4",
17
+ "Flask==3.1.2",
18
+ "fonttools==4.61.1",
19
+ "id==1.6.1",
20
+ "idna==3.11",
21
+ "itsdangerous==2.2.0",
22
+ "jaraco.classes==3.4.0",
23
+ "jaraco.context==6.1.0",
24
+ "jaraco.functools==4.4.0",
25
+ "Jinja2==3.1.6",
26
+ "keyboard==0.13.5",
27
+ "keyring==25.7.0",
28
+ "kiwisolver==1.4.9",
29
+ "lark==1.3.1",
30
+ "markdown-it-py==4.0.0",
31
+ "MarkupSafe==3.0.3",
32
+ "matplotlib==3.10.8",
33
+ "mdurl==0.1.2",
34
+ "more-itertools==10.8.0",
35
+ "nh3==0.3.2",
36
+ "numpy==2.4.2",
37
+ "packaging==26.0",
38
+ "pathlib==1.0.1",
39
+ "pick==2.4.0",
40
+ "pillow==12.1.0",
41
+ "pycparser==3.0",
42
+ "pygame==2.6.1",
43
+ "Pygments==2.19.2",
44
+ "pynput==1.8.1",
45
+ "pyparsing==3.3.2",
46
+ "python-dateutil==2.9.0.post",
47
+ "pywin32-ctypes==0.2.3",
48
+ "readme_renderer==44.0",
49
+ "requests==2.32.5",
50
+ "requests-toolbelt==1.0.0",
51
+ "rfc3986==2.0.0",
52
+ "rich==14.3.2",
53
+ "setuptools==82.0.0",
54
+ "six==1.17.0",
55
+ "sqlparse==0.5.5",
56
+ "twine==6.2.0",
57
+ "tzdata==2025.3",
58
+ "urllib3==2.6.3",
59
+ "Werkzeug==3.1.5",
60
+ "wheel==0.46.3",
61
+ "windows-curses==2.4.1",
62
+
63
+ ]
64
+
65
+ [project.scripts]
66
+ syntactical = "syntactical.syntactical:main"
67
+ syn = "syntactical.syntactical:main"
68
+
69
+ [build-system]
70
+ requires = ["setuptools>=61.0"]
71
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,191 @@
1
+ # IMPORTS
2
+ # some of these are here so they get packaged in the install.
3
+ import sys
4
+ import argparse
5
+ from lark import Lark, Transformer, v_args
6
+ import os
7
+ import requests
8
+ import pathlib
9
+ import numpy
10
+ import json
11
+ import datetime
12
+ import re
13
+ import matplotlib
14
+ import django
15
+ import flask
16
+ os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1' # pygame is a dumbo
17
+ import pygame
18
+ import tkinter
19
+ import time
20
+ import cryptography
21
+ import pynput
22
+ import pick
23
+
24
+
25
+ custom_grammar = r"""
26
+ start: line_content+
27
+ ?line_content: statement (SEMICOLON statement)* [SEMICOLON]
28
+ ?statement: use_stmt | with_stmt | class_def | func_def | return_stmt
29
+ | assignment | if_stmt | while_stmt | for_stmt | try_stmt | expression | from_stmt
30
+ block: "{" line_content+ "}"
31
+ use_stmt: "use" IDENTIFIER ["as" IDENTIFIER]
32
+ from_stmt: "from" IDENTIFIER "use" IDENTIFIER
33
+ with_stmt: "with" expression "as" IDENTIFIER block
34
+ class_def: "class" IDENTIFIER block
35
+ func_def: "func" IDENTIFIER "(" [id_list] ")" block
36
+ return_stmt: "return" expression
37
+ try_stmt: "try" block "catch" IDENTIFIER block
38
+ if_stmt: "if" expression block ["else" block]
39
+ while_stmt: "while" expression block
40
+ ?for_stmt: "for" IDENTIFIER "in" expression "to" expression block -> range_for
41
+ | "for" "(" assignment SEMICOLON expression SEMICOLON assignment ")" block -> c_for
42
+ assignment: target (EQUAL | INPLACE_OP) expression
43
+ inc_dec_stmt: target INC_DEC_OP
44
+ ?expression: logic_or
45
+ ?logic_or: logic_and ("or" logic_and)*
46
+ ?logic_and: logic_not ("and" logic_not)*
47
+ ?logic_not: "not" logic_not -> logic_not | comparison
48
+ ?comparison: sum (COMP_OP sum)*
49
+ ?sum: product (SUM_OP product)*
50
+ ?product: atom (MUL_OP atom)*
51
+ ?atom: lambda_expr | primary | NUMBER | STRING | bool | list | set | dict | "(" expression ")"
52
+ lambda_expr: "lambda" [id_list] "{" expression "}"
53
+ ?primary: dotted_name | primary "(" [arg_list] ")" -> function_call | primary "[" expression "]" -> index_access
54
+ dotted_name: IDENTIFIER ("." IDENTIFIER)*
55
+ arg_list: expression ("," expression)*
56
+ id_list: IDENTIFIER ("," IDENTIFIER)*
57
+ list: "[" [arg_list] "]"
58
+ set: "{" arg_list "}"
59
+ dict: "{" [dict_pairs] "}"
60
+ dict_pairs: key_value ("," key_value)*
61
+ key_value: expression ":" expression
62
+ bool: "true" -> true | "false" -> false
63
+ target: dotted_name ("[" expression "]")*
64
+ EQUAL: "="
65
+ INPLACE_OP: "+=" | "-=" | "*=" | "/="
66
+ INC_DEC_OP: "++" | "--"
67
+ SUM_OP: "+" | "-"
68
+ MUL_OP: "*" | "/"
69
+ COMP_OP: "==" | "!=" | "<" | ">" | "<=" | ">="
70
+ SEMICOLON: ";"
71
+ IDENTIFIER: /[a-zA-Z_][a-zA-Z0-9_]*/
72
+ STRING: /\"\"\"(?s:.*?)\"\"\"|\'\'\'(?s:.*?)\'\'\'|\"(?:[^\"\\\\]|\\\\.)*\"|\'(?:[^\'\\\\]|\\\\.)*\'/
73
+ COMMENT: "//" /[^\n]*/
74
+ %import common.NUMBER
75
+ %import common.WS
76
+ %ignore WS
77
+ %ignore COMMENT
78
+ """
79
+
80
+ @v_args(inline=True)
81
+ class ToPython(Transformer):
82
+ def start(self, *lines):
83
+ # Inject imports automatically
84
+ return "import os\nimport json\nfrom pathlib import Path\n" + "\n".join(map(str, lines))
85
+
86
+ def line_content(self, *statements):
87
+ return "\n".join(str(s) for s in statements if str(s) != ";")
88
+
89
+ def block(self, *lines):
90
+ body = "\n".join(map(str, lines))
91
+ return "\n".join(f" {line}" for line in body.split("\n"))
92
+
93
+ def lambda_expr(self, args=None, expr=None):
94
+ if expr is None: return f"lambda: {args}"
95
+ return f"lambda {args}: {expr}"
96
+
97
+ def function_call(self, name, args=""):
98
+ py_name = str(name)
99
+ call_args = str(args) if args is not None else ""
100
+ if py_name == "print": return f"print({call_args}, end='')"
101
+ if py_name == "println": return f"print({call_args})"
102
+ if py_name == "input": return f"input({call_args})"
103
+ if py_name == "system": return f"os.system({call_args})"
104
+
105
+
106
+ if py_name == "json_encode": return f"json.dumps({call_args})"
107
+ if py_name == "json_decode": return f"json.loads({call_args})"
108
+
109
+
110
+ if py_name == "path": return f"Path({call_args})"
111
+
112
+
113
+
114
+ return f"{py_name}({call_args})"
115
+
116
+ def STRING(self, token):
117
+ raw = str(token)
118
+ return f"f{raw}" if "{" in raw and "}" in raw else raw
119
+
120
+ def use_stmt(self, name, alias=None): return f"import {name} as {alias}" if alias else f"import {name}"
121
+ def from_stmt(self, name, module): return f"from {name} import {module}"
122
+ def try_stmt(self, t_b, e_v, c_b): return f"try:\n{t_b}\nexcept Exception as {e_v}:\n{c_b}"
123
+ def class_def(self, n, b): return f"class {n}:\n{b}"
124
+ def func_def(self, n, a=None, b=""): return f"def {n}({a or ''}):\n{b}"
125
+ def range_for(self, v, s, e, b): return f"for {v} in range({s}, {e}):\n{b}"
126
+ def c_for(self, i, c, s, b): return f"{i}\nwhile {c}:\n{b}\n {s}"
127
+ def if_stmt(self, c, b, eb=None): return f"if {c}:\n{b}" + (f"\nelse:\n{eb}" if eb else "")
128
+ def while_stmt(self, c, b): return f"while {c}:\n{b}"
129
+ def with_stmt(self, c, h, b): return f"with {c} as {h}:\n{b}"
130
+ def return_stmt(self, e): return f"return {e}"
131
+ def assignment(self, t, o, v): return f"{t} {o} {v}"
132
+ def index_access(self, t, i): return f"{t}[{i}]"
133
+ def dotted_name(self, *p): return ".".join(map(str, p))
134
+ def arg_list(self, *i): return ", ".join(map(str, i))
135
+ def id_list(self, *i): return ", ".join(map(str, i))
136
+ def list(self, i=""): return f"[{i or ''}]"
137
+ def set(self, items): return f"{{{items}}}"
138
+ def dict(self, i=""): return f"{{{i or ''}}}"
139
+ def dict_pairs(self, *p): return ", ".join(map(str, p))
140
+ def key_value(self, k, v): return f"{k}: {v}"
141
+ def true(self): return "True"
142
+ def false(self): return "False"
143
+ def logic_not(self, v): return f"not {v}"
144
+ def logic_or(self, *args): return " or ".join(map(str, args))
145
+ def logic_and(self, *args): return " and ".join(map(str, args))
146
+ def target(self, name, *indices):
147
+ res = str(name)
148
+ for idx in indices: res += f"[{idx}]"
149
+ return res
150
+ def comparison(self, *a): return " ".join(map(str, a))
151
+ def sum(self, *a): return " ".join(map(str, a))
152
+ def product(self, *a): return " ".join(map(str, a))
153
+ def IDENTIFIER(self, t): return str(t)
154
+ def NUMBER(self, t): return str(t)
155
+ def COMP_OP(self, t): return str(t)
156
+ def SUM_OP(self, t): return str(t)
157
+ def MUL_OP(self, t): return str(t)
158
+ def INPLACE_OP(self, t): return str(t)
159
+ def INC_DEC_OP(self, t): return str(t)
160
+ def EQUAL(self, t): return str(t)
161
+ def SEMICOLON(self, t): return ";"
162
+
163
+ def main():
164
+ arg_parser = argparse.ArgumentParser(description="Syntactical Language Runner")
165
+ arg_parser.add_argument("filename", help="Path to your script")
166
+ arg_parser.add_argument("-p", "--python", action="store_true", help="Instead of running the code, save it as python in the same directory.")
167
+ args = arg_parser.parse_args()
168
+
169
+ try:
170
+ with open(args.filename, "r") as f: source = f.read()
171
+ l_parser = Lark(custom_grammar, parser='lalr')
172
+ python_code = ToPython().transform(l_parser.parse(source))
173
+
174
+ if not args.python:
175
+ exec(python_code, {"__name__": "__main__"})
176
+ else:
177
+ if args.filename.endswith(".syn"):
178
+ python_file_name = f"{args.filename[:-4]}.py"
179
+ else:
180
+ python_file_name = f"{args.filename}.py"
181
+ if os.path.isfile(python_file_name):
182
+ print("File already exists.")
183
+ exit(1)
184
+ else:
185
+ with open(python_file_name, 'w') as f:
186
+ f.write(python_code)
187
+ except Exception as e:
188
+ print(f"Syntactical Error: {e}")
189
+
190
+ if __name__ == "__main__":
191
+ main()
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: syntactical
3
+ Version: 1.2.1
4
+ Requires-Dist: asgiref==3.11.1
5
+ Requires-Dist: blinker==1.9.0
6
+ Requires-Dist: certifi==2026.1.4
7
+ Requires-Dist: cffi==2.0.0
8
+ Requires-Dist: charset-normalizer==3.4.4
9
+ Requires-Dist: click==8.3.1
10
+ Requires-Dist: colorama==0.4.6
11
+ Requires-Dist: contourpy==1.3.3
12
+ Requires-Dist: cryptography==46.0.4
13
+ Requires-Dist: cycler==0.12.1
14
+ Requires-Dist: Django==6.0.2
15
+ Requires-Dist: docutils==0.22.4
16
+ Requires-Dist: Flask==3.1.2
17
+ Requires-Dist: fonttools==4.61.1
18
+ Requires-Dist: id==1.6.1
19
+ Requires-Dist: idna==3.11
20
+ Requires-Dist: itsdangerous==2.2.0
21
+ Requires-Dist: jaraco.classes==3.4.0
22
+ Requires-Dist: jaraco.context==6.1.0
23
+ Requires-Dist: jaraco.functools==4.4.0
24
+ Requires-Dist: Jinja2==3.1.6
25
+ Requires-Dist: keyboard==0.13.5
26
+ Requires-Dist: keyring==25.7.0
27
+ Requires-Dist: kiwisolver==1.4.9
28
+ Requires-Dist: lark==1.3.1
29
+ Requires-Dist: markdown-it-py==4.0.0
30
+ Requires-Dist: MarkupSafe==3.0.3
31
+ Requires-Dist: matplotlib==3.10.8
32
+ Requires-Dist: mdurl==0.1.2
33
+ Requires-Dist: more-itertools==10.8.0
34
+ Requires-Dist: nh3==0.3.2
35
+ Requires-Dist: numpy==2.4.2
36
+ Requires-Dist: packaging==26.0
37
+ Requires-Dist: pathlib==1.0.1
38
+ Requires-Dist: pick==2.4.0
39
+ Requires-Dist: pillow==12.1.0
40
+ Requires-Dist: pycparser==3.0
41
+ Requires-Dist: pygame==2.6.1
42
+ Requires-Dist: Pygments==2.19.2
43
+ Requires-Dist: pynput==1.8.1
44
+ Requires-Dist: pyparsing==3.3.2
45
+ Requires-Dist: python-dateutil==2.9.0.post
46
+ Requires-Dist: pywin32-ctypes==0.2.3
47
+ Requires-Dist: readme_renderer==44.0
48
+ Requires-Dist: requests==2.32.5
49
+ Requires-Dist: requests-toolbelt==1.0.0
50
+ Requires-Dist: rfc3986==2.0.0
51
+ Requires-Dist: rich==14.3.2
52
+ Requires-Dist: setuptools==82.0.0
53
+ Requires-Dist: six==1.17.0
54
+ Requires-Dist: sqlparse==0.5.5
55
+ Requires-Dist: twine==6.2.0
56
+ Requires-Dist: tzdata==2025.3
57
+ Requires-Dist: urllib3==2.6.3
58
+ Requires-Dist: Werkzeug==3.1.5
59
+ Requires-Dist: wheel==0.46.3
60
+ Requires-Dist: windows-curses==2.4.1
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/syntactical/__init__.py
4
+ src/syntactical/syntactical.py
5
+ src/syntactical.egg-info/PKG-INFO
6
+ src/syntactical.egg-info/SOURCES.txt
7
+ src/syntactical.egg-info/dependency_links.txt
8
+ src/syntactical.egg-info/entry_points.txt
9
+ src/syntactical.egg-info/requires.txt
10
+ src/syntactical.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ syn = syntactical.syntactical:main
3
+ syntactical = syntactical.syntactical:main
@@ -0,0 +1,57 @@
1
+ asgiref==3.11.1
2
+ blinker==1.9.0
3
+ certifi==2026.1.4
4
+ cffi==2.0.0
5
+ charset-normalizer==3.4.4
6
+ click==8.3.1
7
+ colorama==0.4.6
8
+ contourpy==1.3.3
9
+ cryptography==46.0.4
10
+ cycler==0.12.1
11
+ Django==6.0.2
12
+ docutils==0.22.4
13
+ Flask==3.1.2
14
+ fonttools==4.61.1
15
+ id==1.6.1
16
+ idna==3.11
17
+ itsdangerous==2.2.0
18
+ jaraco.classes==3.4.0
19
+ jaraco.context==6.1.0
20
+ jaraco.functools==4.4.0
21
+ Jinja2==3.1.6
22
+ keyboard==0.13.5
23
+ keyring==25.7.0
24
+ kiwisolver==1.4.9
25
+ lark==1.3.1
26
+ markdown-it-py==4.0.0
27
+ MarkupSafe==3.0.3
28
+ matplotlib==3.10.8
29
+ mdurl==0.1.2
30
+ more-itertools==10.8.0
31
+ nh3==0.3.2
32
+ numpy==2.4.2
33
+ packaging==26.0
34
+ pathlib==1.0.1
35
+ pick==2.4.0
36
+ pillow==12.1.0
37
+ pycparser==3.0
38
+ pygame==2.6.1
39
+ Pygments==2.19.2
40
+ pynput==1.8.1
41
+ pyparsing==3.3.2
42
+ python-dateutil==2.9.0.post
43
+ pywin32-ctypes==0.2.3
44
+ readme_renderer==44.0
45
+ requests==2.32.5
46
+ requests-toolbelt==1.0.0
47
+ rfc3986==2.0.0
48
+ rich==14.3.2
49
+ setuptools==82.0.0
50
+ six==1.17.0
51
+ sqlparse==0.5.5
52
+ twine==6.2.0
53
+ tzdata==2025.3
54
+ urllib3==2.6.3
55
+ Werkzeug==3.1.5
56
+ wheel==0.46.3
57
+ windows-curses==2.4.1
@@ -0,0 +1 @@
1
+ syntactical