N-Prolog Mode Inference Prototype
I implemented a prototype mode inference system for N-Prolog.
The system analyzes predicates and infers input/output modes automatically using a two-pass analysis. The current prototype can already infer modes for predicates such as partition/4, fact/2, and even qsort/3.
The long-term goal is to identify predicates that behave like deterministic functions and replace them with optimized C functions while preserving normal Prolog semantics.
Preliminary experiments show speed improvements of around 3–4x for analyzable predicates.
I wrote a technical overview here:
N-Prolog Mode Inference Prototype | by Kenichi Sasagawa | May, 2026 | Medium