pub mod lexer;
pub mod parser;
pub mod runtime;
pub mod stdlib;
pub mod testing;
pub mod performance;
pub mod http_server;
pub mod http_server_security;
pub mod http_server_security_middleware;
pub mod http_server_middleware;
pub mod http_server_converters;
pub mod http_server_handlers;
pub mod http_server_integration;
pub mod ffi;
pub mod solidity_converter;
pub use http_server_security::{RateLimiter, RequestSizeLimiter, InputValidator, SecurityLogger};
pub use ffi::security::{FFIInputValidator, FFIResourceLimits};
pub use lexer::{Lexer, tokens::Token};
pub use parser::{Parser, ast, error::ParserError};
pub use runtime::{Runtime, values::Value};
pub use ffi::{FFIInterface, FFIConfig, InterfaceType};
pub use testing::{
TestCase, TestSuite, TestResult, TestStatus, TestConfig, TestRunner,
MockFunction, MockRegistry, MockBuilder,
};
pub fn parse_source(source: &str) -> Result<ast::Program, Box<dyn std::error::Error>> {
let lexer = Lexer::new(source);
let tokens_with_pos = lexer
.tokenize_with_positions_immutable()
.map_err(|e| Box::new(e) as Box<dyn std::error::Error>)?;
let mut parser = Parser::new_with_positions(tokens_with_pos);
parser.parse().map_err(|e| Box::new(e) as Box<dyn std::error::Error>)
}
pub fn execute_source(source: &str) -> Result<Value, Box<dyn std::error::Error>> {
let program = parse_source(source)?;
let mut runtime = Runtime::new();
let result = runtime.execute_program(program).map_err(|e| Box::new(e) as Box<dyn std::error::Error>)?;
Ok(result.unwrap_or(Value::Null))
}