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
+3 -12
View File
@@ -61,7 +61,7 @@ impl Default for CompilerApp {
})
.unwrap_or_default();
let env = Environment::new().with_cwd();
let env = Environment::new();
Self {
source_code: String::from(
@@ -96,14 +96,10 @@ impl CompilerApp {
self.trace_logs.clear();
// Reset environment for a fresh run
self.env = Environment::new().with_cwd();
self.env = Environment::new();
self.env.optimization = true;
let res = (|| -> Result<(myc::ast::types::Value, std::time::Duration), String> {
if let Err(e) = self.env.preload_dependencies(&self.source_code, self.current_example_path.as_deref()) {
return Err(format!("Dependency Error: {}", e));
}
let start_run = std::time::Instant::now();
let result = if self.debug_enabled {
let (res, logs) = self.env.run_debug(&self.source_code)?;
@@ -162,14 +158,9 @@ impl CompilerApp {
}
fn dump_ast(&mut self) {
self.env = Environment::new().with_cwd();
self.env = Environment::new();
self.env.optimization = true; // Enable optimization for AST dump
if let Err(e) = self.env.preload_dependencies(&self.source_code, self.current_example_path.as_deref()) {
self.output_log = format!("Dependency Error: {}", e);
return;
}
match self.env.dump_ast(&self.source_code) {
Ok(dump) => {
self.output_log = format!("--- BOUND AST DUMP ---\n\n{}", dump);