Files
RustAst/examples
Michael Schimmel 0107264026 feat: Implement purity inference for optimization
This commit introduces purity inference to the compiler's optimizer.
This allows for more aggressive constant folding and dead code
elimination by tracking which functions and global variables
are free of side effects.

Key changes include:

- Added `global_purity` field to `Optimizer` and `Environment`.
- Modified `Optimizer::is_pure` to recursively determine if an
  AST node represents a pure computation.
- Introduced `Optimizer::try_fold_pure` to replace the old
  `try_fold_intrinsic`, enabling folding of pure function calls
  with constant arguments.
- Updated `Environment::register_native` and
  `Environment::register_constant`
  to optionally record purity.
- Added purity flags to several built-in functions in `core.rs` and
  `datetime.rs`.
- A new example `optimizer_purity.myc` demonstrates the new feature.
2026-02-22 00:16:04 +01:00
..
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00
2026-02-21 15:16:36 +01:00