| Crates.io | frut_std |
| lib.rs | frut_std |
| version | 0.0.4 |
| created_at | 2025-10-29 15:00:54.051948+00 |
| updated_at | 2025-11-06 10:56:09.509461+00 |
| description | Standard library for the Frut language |
| homepage | |
| repository | https://github.com/BenimFurka/frut_std |
| max_upload_size | |
| id | 1906758 |
| size | 31,524 |
Standard library for the Frut programming language. Provides built-in functions, native modules, and primitive-method helpers for use with the frut_lib analyzer and runtime.
Add this to your Cargo.toml:
[dependencies]
frut_std = "0.0.4"
Or use this comand:
cargo add frut_std
print(string): void, println(string): void, input(string): string.std/io: re-exports print, println, input.std/math: abs_i(int): int, abs_d(double): double, min_i(int,int): int, min_d(double,double): double, max_i(int,int): int, max_d(double,double): double.string.len(): int, string.contains(string): boolint.abs(): int, double.abs(): doublebool.to_int(): intHey, crate is not finished yet, but its working.
Use with frut_lib by predeclaring built-ins for semantic analysis and registering native implementations in the runtime:
use frut_lib::{semantic::SemanticAnalyzer, value::RuntimeEnvironment};
use frut_std::{predeclare_std_builtins, register_std_builtins, register_native_modules};
fn setup() {
// Semantic predeclare
let mut analyzer = SemanticAnalyzer::default();
predeclare_std_builtins(&mut analyzer).unwrap();
// Runtime registration
let mut env = RuntimeEnvironment::default();
register_std_builtins(&mut env);
// Optionally register specific native modules (or None to import all symbols)
register_native_modules(
&mut env,
&[
("std/io".to_string(), None),
("std/math".to_string(), None),
],
);
}
In Frut code you can import and use modules:
import std.io;
import std.math;
println("Hello, Frut!");
println("min: " + min_i(3, 5));
Try also frut_interp crate to run this code, that crate uses frut_std crate.
See the Frut wiki for the standard library overview and usage:
Licensed under the Apache License, Version 2.0 LICENSE.