lucidaflow 1.0.7__tar.gz → 1.0.8__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.
Potentially problematic release.
This version of lucidaflow might be problematic. Click here for more details.
- {lucidaflow-1.0.7/src/lucidaflow.egg-info → lucidaflow-1.0.8}/PKG-INFO +1 -1
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/pyproject.toml +1 -1
- lucidaflow-1.0.8/src/lucidaflow/cli.py +86 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8/src/lucidaflow.egg-info}/PKG-INFO +1 -1
- lucidaflow-1.0.7/src/lucidaflow/cli.py +0 -50
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/LICENSE +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/README.md +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/setup.cfg +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/__init__.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lib/__init__.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lib/dado.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lib/json.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lib/web.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_analyzer.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_ast.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_errors.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_interpreter.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_lexer.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_parser.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_stdlib.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow/lucida_symbols.py +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow.egg-info/SOURCES.txt +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow.egg-info/dependency_links.txt +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow.egg-info/entry_points.txt +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow.egg-info/requires.txt +0 -0
- {lucidaflow-1.0.7 → lucidaflow-1.0.8}/src/lucidaflow.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lucidaflow
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.8
|
|
4
4
|
Summary: Uma linguagem de script moderna, extensível e com tipagem gradual, implementada em Python.
|
|
5
5
|
Author-email: Marco Lago <marconeed2@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/marconeed/Lucida-Flow
|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "lucidaflow"
|
|
9
|
-
version = "1.0.
|
|
9
|
+
version = "1.0.8" # Aumentei a versão para a nova publicação
|
|
10
10
|
authors = [
|
|
11
11
|
{ name="Marco Lago", email="marconeed2@gmail.com" },
|
|
12
12
|
]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# src/lucidaflow/cli.py
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from lucidaflow.lucida_lexer import Lexer
|
|
5
|
+
from lucidaflow.lucida_parser import Parser
|
|
6
|
+
from lucidaflow.lucida_analyzer import SemanticAnalyzer
|
|
7
|
+
from lucidaflow.lucida_interpreter import Interpreter
|
|
8
|
+
from lucidaflow.lucida_errors import LucidaError
|
|
9
|
+
from lucidaflow.lucida_ast import ProgramNode
|
|
10
|
+
|
|
11
|
+
# --- Funções de Execução ---
|
|
12
|
+
|
|
13
|
+
def run_code(source_code):
|
|
14
|
+
"""Função que executa um trecho de código da Lucida-Flow."""
|
|
15
|
+
# Cada execução tem seu próprio ambiente limpo
|
|
16
|
+
analyzer = SemanticAnalyzer()
|
|
17
|
+
interpreter = Interpreter()
|
|
18
|
+
|
|
19
|
+
lexer = Lexer(source_code)
|
|
20
|
+
parser = Parser(lexer)
|
|
21
|
+
ast = parser.parse()
|
|
22
|
+
|
|
23
|
+
analyzer.visit(ast)
|
|
24
|
+
result = interpreter.visit(ast)
|
|
25
|
+
return result
|
|
26
|
+
|
|
27
|
+
def run_file(filename):
|
|
28
|
+
"""Lê e executa um ficheiro .lf."""
|
|
29
|
+
try:
|
|
30
|
+
with open(filename, 'r', encoding='utf-8') as f:
|
|
31
|
+
source_code = f.read()
|
|
32
|
+
run_code(source_code)
|
|
33
|
+
except FileNotFoundError:
|
|
34
|
+
print(f"Erro: O ficheiro '{filename}' não foi encontrado.")
|
|
35
|
+
except LucidaError as e:
|
|
36
|
+
print("--- OCORREU UM ERRO NA LUCIDA-FLOW ---")
|
|
37
|
+
print(e)
|
|
38
|
+
except Exception as e:
|
|
39
|
+
print("--- OCORREU UM ERRO INESPERADO NO SISTEMA ---")
|
|
40
|
+
print(e)
|
|
41
|
+
|
|
42
|
+
def start_repl():
|
|
43
|
+
"""Inicia o modo interativo (REPL)."""
|
|
44
|
+
print("Lucida-Flow REPL v1.0 (Instalado via pip)")
|
|
45
|
+
print("Digite 'exit' ou 'sair' para terminar.")
|
|
46
|
+
|
|
47
|
+
analyzer = SemanticAnalyzer()
|
|
48
|
+
interpreter = Interpreter()
|
|
49
|
+
analyzer.visit(ProgramNode([]))
|
|
50
|
+
|
|
51
|
+
while True:
|
|
52
|
+
try:
|
|
53
|
+
line = input("lf> ")
|
|
54
|
+
if line.strip().lower() in ('exit', 'sair'): break
|
|
55
|
+
if not line.strip(): continue
|
|
56
|
+
|
|
57
|
+
# Reutiliza o mesmo analyzer e interpreter para manter o estado no REPL
|
|
58
|
+
lexer = Lexer(line)
|
|
59
|
+
parser = Parser(lexer)
|
|
60
|
+
ast = parser.parse()
|
|
61
|
+
analyzer.visit(ast)
|
|
62
|
+
result = interpreter.visit(ast)
|
|
63
|
+
|
|
64
|
+
if result is not None:
|
|
65
|
+
print(result)
|
|
66
|
+
except LucidaError as e:
|
|
67
|
+
print(e)
|
|
68
|
+
except Exception as e:
|
|
69
|
+
print(f"Erro de sistema: {e}")
|
|
70
|
+
|
|
71
|
+
# --- Ponto de Entrada Principal ---
|
|
72
|
+
|
|
73
|
+
def main():
|
|
74
|
+
"""Verifica os argumentos e decide se executa um ficheiro ou inicia o REPL."""
|
|
75
|
+
# sys.argv é a lista de argumentos da linha de comando.
|
|
76
|
+
# sys.argv[0] é o nome do script, o resto são os argumentos.
|
|
77
|
+
if len(sys.argv) > 1:
|
|
78
|
+
# Se um argumento foi passado, assumimos que é um nome de ficheiro
|
|
79
|
+
script_file = sys.argv[1]
|
|
80
|
+
run_file(script_file)
|
|
81
|
+
else:
|
|
82
|
+
# Se nenhum argumento foi passado, inicia o REPL
|
|
83
|
+
start_repl()
|
|
84
|
+
|
|
85
|
+
if __name__ == '__main__':
|
|
86
|
+
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lucidaflow
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.8
|
|
4
4
|
Summary: Uma linguagem de script moderna, extensível e com tipagem gradual, implementada em Python.
|
|
5
5
|
Author-email: Marco Lago <marconeed2@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/marconeed/Lucida-Flow
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# src/lucidaflow/cli.py
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from lucidaflow.lucida_lexer import Lexer
|
|
5
|
-
from lucidaflow.lucida_parser import Parser
|
|
6
|
-
from lucidaflow.lucida_analyzer import SemanticAnalyzer
|
|
7
|
-
from lucidaflow.lucida_interpreter import Interpreter
|
|
8
|
-
from lucidaflow.lucida_errors import LucidaError
|
|
9
|
-
from lucidaflow.lucida_ast import ProgramNode
|
|
10
|
-
|
|
11
|
-
def run_code(source_code, analyzer, interpreter):
|
|
12
|
-
lexer = Lexer(source_code)
|
|
13
|
-
parser = Parser(lexer)
|
|
14
|
-
ast = parser.parse()
|
|
15
|
-
analyzer.visit(ast)
|
|
16
|
-
result = interpreter.visit(ast)
|
|
17
|
-
return result
|
|
18
|
-
|
|
19
|
-
def start_repl():
|
|
20
|
-
print("Lucida-Flow REPL v1.0 (Instalado via pip)")
|
|
21
|
-
print("Digite 'exit' ou 'sair' para terminar.")
|
|
22
|
-
|
|
23
|
-
analyzer = SemanticAnalyzer()
|
|
24
|
-
interpreter = Interpreter()
|
|
25
|
-
analyzer.visit(ProgramNode([]))
|
|
26
|
-
|
|
27
|
-
while True:
|
|
28
|
-
try:
|
|
29
|
-
line = input("lf> ")
|
|
30
|
-
if line.strip().lower() in ('exit', 'sair'):
|
|
31
|
-
break
|
|
32
|
-
|
|
33
|
-
if not line.strip():
|
|
34
|
-
continue
|
|
35
|
-
|
|
36
|
-
result = run_code(line, analyzer, interpreter)
|
|
37
|
-
|
|
38
|
-
if result is not None:
|
|
39
|
-
print(result)
|
|
40
|
-
except LucidaError as e:
|
|
41
|
-
print(e)
|
|
42
|
-
except Exception as e:
|
|
43
|
-
print(f"Erro de sistema: {e}")
|
|
44
|
-
|
|
45
|
-
def main():
|
|
46
|
-
# Por agora, a nossa ferramenta de linha de comando só inicia o REPL.
|
|
47
|
-
start_repl()
|
|
48
|
-
|
|
49
|
-
if __name__ == '__main__':
|
|
50
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|