Grupo 4: I/O e stdlib #55
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Mudanças para Suporte a Meta Statements e Biblioteca Padrão (stdlib)
1. Meta Statements
Meta statements são comandos especiais reconhecidos pelo interpretador, que executam funções integradas diretamente no ambiente de execução.
Statement::MetaStmt(String)na AST (src/ir/ast.rs).src/interpreter/statement_execute.rs) agora reconhece esse tipo de statement e consulta uma tabela global de metabuiltins.2. Biblioteca Padrão (stdlib)
A stdlib implementa funções integradas (metabuiltins) como
input,printeopen, acessíveis via meta statements.METABUILTINS_TABLE) emsrc/stdlib/standard_library.rsusandoOnceLockpara garantir inicialização thread-safe.Statement::Return.input(prompt?): Lê uma linha do usuário, exibindo um prompt opcional.print(value?): Imprime um valor na saída padrão.open(path, mode?): Abre um arquivo para leitura ou escrita.3. Integração com o Interpretador
MetaStmt, consulta a tabela de metabuiltins.4. Extensibilidade
MetaBuiltinStmt.get_metabuiltins_table().5. Exemplo de Uso
6. Referências de Código
src/ir/ast.rssrc/interpreter/statement_execute.rssrc/stdlib/standard_library.rssrc/stdlib/README.md