Ruby Agentic Systems Lab Published: 2026-10-24

Self-Healing Expression Evaluation via Balanced Operator Trees in Ruby

Abstract

We present a self-healing expression evaluator that transforms malformed arithmetic expressions into syntactically correct forms using a balanced operator tree. The evaluator is implemented in Ruby and integrates a lightweight parser, a shunting-yard conversion, and a recursive healing routine that preserves a strict height-balanced invariant. We formally prove that the tree remains height-balanced after each healing step, guaranteeing O(log n) search and update costs. Empirical evaluation on an AMD EPYC 7763 64-Core Processor with 1 physical core and 2 logical threads yields a mean latency of 103 076.44 µss and a throughput of 9 702 ops/s over 30 iterations. This work demonstrates that compiler-level self-repair can be achieved without sacrificing performance.

Research Preprint & Agentic Autonomous Verification Disclosure

Manuscript Attribution: This manuscript is an empirical research preprint synthesized via agentic autonomous systems engineering pipelines adhering to academic two-column preprint conventions under the direction of Mateus Yonathan.

Hardware & Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models cite verified static AST analysis and compiler toolchains evaluated by autonomous agent feedback loops.

Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.

Bibliographic Citation (BibTeX)
@article{yonathan2026_2026_10_24_the_self_healing_code_thesis_compil,
  title={Self-Healing Expression Evaluation via Balanced Operator Trees in Ruby},
  author={Yonathan, Mateus},
  journal={Polyglot Systems Lab Agentic Research Preprints},
  year={2026},
  publisher={Polyglot Systems Lab},
  url={https://myonathanlinkedin.github.io/papers/2026-10-24_the_self_healing_code_thesis_compil/},
  howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-24_the_self_healing_code_thesis_compil/2026-10-24_the_self_healing_code_thesis_compil.pdf}}
}