Skip to content

Feat/ast optimizations#9

Merged
LyeZinho merged 5 commits intomainfrom
feat/ast-optimizations
Feb 14, 2026
Merged

Feat/ast optimizations#9
LyeZinho merged 5 commits intomainfrom
feat/ast-optimizations

Conversation

@LyeZinho
Copy link
Member

No description provided.

pedro added 5 commits February 14, 2026 14:27
- Add FFI module with dlopen/dlsym support via libloading crate
- Implement ffi_load_library, ffi_unload_library, ffi_call functions
- Support for void, i32, i64, f64, string, and pointer return types
- Add libloading dependency to Cargo.toml
- Update GitHub workflow with improved CI pipeline (tests, clippy, format, Windows build)
- Parser: adicionada palavra-chave 'new' para instanciação de classes
- Parser: corrigido parsing de super.method() para expressões
- Lexer: corrigida mensagem de erro para diretiva nativa vazia
- Runtime: padronizado código de erro 6001 para funções nativas
- Runtime: adicionados módulos debug, environment, native_registry
- Runtime: melhorias em todos os módulos nativos (heap integration)
- Runtime: adicionada documentação e testes
- CLI: melhorias no gerenciador de pacotes oak
- Docs: atualizada documentação de implementação
- Adicionados 12 testes cobrindo:
  - Carregamento de bibliotecas (caminhos válidos e inválidos)
  - Descarregamento de bibliotecas
  - Chamadas de funções (argumentos insuficientes, tipos de retorno)
  - Verificação de símbolos
  - Listagem de bibliotecas carregadas
  - Validação de argumentos
- Adicionado suporte HMAC (SHA256, SHA512) ao módulo crypto
- Novo módulo json_stream para parsing incremental de JSON
- Novo módulo websocket para cliente e servidor WebSocket
- Novo módulo database para SQLite e PostgreSQL
- Documentação completa em docs/stdlib/
- Adicionado módulo optimizer para otimização de AST
- Implementado Constant Folding para operações aritméticas
- Implementado Constant Folding para comparações
- Implementado Short-Circuit Evaluation para booleanos
- Suporte a unary operators (negação, not)
- Criada documentação em docs/internals/optimizer.md

fn optimize_expression(&mut self, expr: &mut Expr) {
match expr {
Expr::Binary(left, op, right, _) => {

Check warning

Code scanning / clippy

unused variable: op Warning

unused variable: op
self.optimize_expression(right);
self.constant_folding_binary(expr);
}
Expr::Unary(op, operand, _) => {

Check warning

Code scanning / clippy

unused variable: op Warning

unused variable: op
String(String),
Boolean(bool),
Null,
Array(Vec<ConstantValue>),

Check warning

Code scanning / clippy

field 0 is never read Warning

field 0 is never read
String(String),
Boolean(bool),
Null,
Array(Vec<ConstantValue>),

Check warning

Code scanning / clippy

field 0 is never read Warning

field 0 is never read
use std::collections::{HashSet, HashMap};
use std::sync::{Arc, Mutex};
use serde::{Serialize, Deserialize};
use crate::value::Value;

Check warning

Code scanning / clippy

unused import: crate::value::Value Warning

unused import: crate::value::Value
@@ -0,0 +1,76 @@
use std::net::SocketAddr;

Check warning

Code scanning / clippy

unused import: std::net::SocketAddr Warning

unused import: std::net::SocketAddr
@@ -0,0 +1,76 @@
use std::net::SocketAddr;
use std::sync::Arc;

Check warning

Code scanning / clippy

unused import: std::sync::Arc Warning

unused import: std::sync::Arc
use std::net::SocketAddr;
use std::sync::Arc;
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};

Check warning

Code scanning / clippy

unused import: AsyncReadExt Warning

unused import: AsyncReadExt
use std::sync::Arc;
use tokio::net::{TcpListener, TcpStream};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use crate::debug::{SharedDebugState, DebugCommand, DebugEvent};

Check warning

Code scanning / clippy

unused import: DebugEvent Warning

unused import: DebugEvent
Comment on lines +15 to +24
pub fn new() -> Self {
Self {
variables: HashMap::new(),
constants: HashMap::new(),
classes: HashMap::new(),
current_instance: None,
imported_modules: HashMap::new(),
call_stack_vars: Vec::new(),
}
}

Check warning

Code scanning / clippy

you should consider adding a Default implementation for Environment Warning

you should consider adding a Default implementation for Environment
@LyeZinho LyeZinho merged commit e8dfaa1 into main Feb 14, 2026
2 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant