egglang 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.
@@ -0,0 +1,5 @@
1
+
2
+
3
+ from .Lexer.main import Lexer
4
+ from .Parser.main import Parser
5
+ from .Interpreter.main import Interpreter
egglang-2.0/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adib
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
24
+
25
+ (r"""
26
+ ███████╗ ██████╗ ██████╗
27
+ ██╔════╝██╔════╝ ██╔════╝
28
+ █████╗ ██║ ███╗██║ ███╗
29
+ ██╔══╝ ██║ ██║██║ ██║
30
+ ███████╗╚██████╔╝╚██████╔╝
31
+ ╚══════╝ ╚═════╝ ╚═════╝
32
+
33
+ """)
34
+
35
+
egglang-2.0/PKG-INFO ADDED
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: egglang
3
+ Version: 2.0
4
+ License-File: LICENSE
5
+ Dynamic: license-file
egglang-2.0/README.md ADDED
File without changes
File without changes
@@ -0,0 +1,47 @@
1
+ from INTERPRETER import Lexer, Parser, Interpreter
2
+
3
+ class CLIEditor:
4
+ def __init__(self):
5
+ self.lexer = Lexer()
6
+ self.parser = Parser()
7
+ self.interpreter = Interpreter()
8
+
9
+ def start(self):
10
+ print("""
11
+ ███████╗ ██████╗ ██████╗
12
+ ██╔════╝██╔════╝ ██╔════╝
13
+ █████╗ ██║ ███╗██║ ███╗
14
+ ██╔══╝ ██║ ██║██║ ██║
15
+ ███████╗╚██████╔╝╚██████╔╝
16
+ ╚══════╝ ╚═════╝ ╚═════╝
17
+ """)
18
+ while True:
19
+ buffer = self.read_block()
20
+ if buffer is None:
21
+ break
22
+ if buffer.strip():
23
+ self.run(buffer)
24
+
25
+ def read_block(self):
26
+ line = input("/>")
27
+ if line.strip() == "exit":
28
+ return None
29
+ lines = [line]
30
+ while line.rstrip().endswith("{") or self.is_indented(line):
31
+ line = input("... ")
32
+ if line.strip() == "":
33
+ break
34
+ lines.append(line)
35
+
36
+ return "\n".join(lines)
37
+
38
+ def is_indented(self, line):
39
+ return line.startswith(" ") or line.startswith("\t")
40
+
41
+ def run(self, code):
42
+ try:
43
+ tokens = self.lexer.tokenise(code + "\n")
44
+ ast = self.parser.parse(tokens)
45
+ self.interpreter.interpret(ast)
46
+ except Exception as e:
47
+ print(e)
@@ -0,0 +1,46 @@
1
+ from pathlib import Path
2
+ import typer
3
+ from INTERPRETER import Lexer, Parser, Interpreter
4
+ from INTERPRETER.Errors.cli import UnknownCmdError, FileNotFoundError
5
+ from .editor import CLIEditor
6
+
7
+
8
+ app = typer.Typer()
9
+
10
+
11
+ @app.command()
12
+ def run(file:str, i:bool=False):
13
+ file = Path(file)
14
+ if file.suffix != ".el":
15
+ raise UnknownCmdError(f"File should always contain .egg extension >> {file}", file)
16
+ if not file.exists():
17
+ raise FileNotFoundError(f"File not found >> {file}", f"{file.cwd()}/{file}")
18
+ code = file.read_text() +"\n"
19
+ lexer = Lexer()
20
+ tokens = lexer.tokenise(code)
21
+ parser = Parser()
22
+ ast = parser.parse(tokens)
23
+ interpreter = Interpreter()
24
+ interpreter.interpret(ast)
25
+ @app.command()
26
+ def doc():
27
+ print("""
28
+ docs & source → https://github.com/codeaddicthq/egg/rules.md
29
+ """)
30
+ @app.command()
31
+ def info():
32
+ print("""
33
+ EGG — Well it been a dream since i learned programing that one day i will have a lang of my own thats why i have made it.
34
+ However i have learned and explored some of data structures like binary tree made a parser and so on
35
+ Main things: lexing, parsing, interpreting.
36
+ Just a personal experiment.
37
+
38
+ docs & source → https://github.com/codeaddicthq/egg
39
+ """)
40
+ def main():
41
+ try:
42
+ app()
43
+ except Exception as e:
44
+ print(e)
45
+ if __name__ == "__main__":
46
+ main()
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: egglang
3
+ Version: 2.0
4
+ License-File: LICENSE
5
+ Dynamic: license-file
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ INTERPRETER/__init__.py
5
+ SHELL/__init__.py
6
+ SHELL/editor.py
7
+ SHELL/main.py
8
+ egglang.egg-info/PKG-INFO
9
+ egglang.egg-info/SOURCES.txt
10
+ egglang.egg-info/dependency_links.txt
11
+ egglang.egg-info/entry_points.txt
12
+ egglang.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ egg = SHELL.main:main
@@ -0,0 +1,2 @@
1
+ INTERPRETER
2
+ SHELL
@@ -0,0 +1,13 @@
1
+ [project]
2
+ name = "egglang"
3
+ version = "2.0"
4
+
5
+ [project.scripts]
6
+ egg = "SHELL.main:main"
7
+
8
+ [build-system]
9
+ requires = ["setuptools"]
10
+ build-backend = "setuptools.build_meta"
11
+
12
+ [tool.setuptools]
13
+ packages = ["SHELL", "INTERPRETER"]
egglang-2.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+