Remove unused system library and simplify environment initialization

The `system.myc` file, containing macros and core utilities, has been
removed as its functionality is now handled by an embedded string. This
simplifies the build process and eliminates a file that was no longer
strictly necessary.

Additionally, the `with_cwd()` method on the `Environment` has been
removed. The environment now automatically adds the current working
directory and its `rtl` subdirectory to the search paths during
initialization. This streamlines the setup for file-based usage and
ensures standard search paths are always considered.
This commit is contained in:
Michael Schimmel
2026-03-08 13:09:53 +01:00
parent 4dfdc75545
commit b622f7f8bd
6 changed files with 42 additions and 98 deletions
+4 -28
View File
@@ -27,7 +27,7 @@ pub fn run_functional_tests_with_optimization(enabled: bool) -> Vec<TestResult>
let output_re = Regex::new(r";; Output: (.*)").unwrap();
for entry in entries.filter_map(|e| e.ok()) {
let mut env = Environment::new().with_cwd(); // Fresh environment per test file
let mut env = Environment::new(); // Fresh environment per test file
env.optimization = enabled;
let path = entry.path();
if path.extension().is_some_and(|ext| ext == "myc") {
@@ -39,15 +39,6 @@ pub fn run_functional_tests_with_optimization(enabled: bool) -> Vec<TestResult>
.map(|m| m.get(1).unwrap().as_str().trim().to_string());
if let Some(expected) = expected_output {
if let Err(e) = env.preload_dependencies(&content, Some(&path)) {
results.push(TestResult {
name,
success: false,
message: format!("Dependency Error: {}", e),
});
continue;
}
match env.run_script(&content) {
Ok(val) => {
let val_str = format!("{}", val);
@@ -120,20 +111,8 @@ pub fn run_benchmarks(update: bool, filter: Option<&str>) -> Vec<BenchmarkResult
.unwrap_or(1);
// Compile once for this file (symbols/types are compatible with all fresh environments)
let initial_env = Environment::new().with_cwd();
if let Err(e) = initial_env.preload_dependencies(&content, Some(&path)) {
results.push(BenchmarkResult {
name,
median: Duration::ZERO,
baseline: None,
diff_pct: None,
status: format!("DEPENDENCY ERROR: {}", e),
});
continue;
}
let compiled_once = match initial_env.compile(&content).into_result() {
let env = Environment::new();
let compiled_once = match env.compile(&content).into_result() {
Ok(c) => c,
Err(e) => {
results.push(BenchmarkResult {
@@ -150,10 +129,7 @@ pub fn run_benchmarks(update: bool, filter: Option<&str>) -> Vec<BenchmarkResult
// Helper to measure sum of VM execution times over N executions in one environment
let measure_sum =
|n: u32, node: &crate::ast::compiler::TypedNode| -> Result<Duration, String> {
let env = Environment::new().with_cwd();
if let Err(e) = env.preload_dependencies(&content, Some(&path)) {
return Err(format!("Dependency Error in measurement: {}", e));
}
let env = Environment::new();
// Link once per sample
let linked = env.link(node.clone());