Prolog 编译器 zipc 将子句编译至 ZIP 虚拟机
zipc 是一个用 Prolog 编写、运行于 Scryer Prolog 的编译器,将 Prolog 子句编译为二进制镜像,交由 C 实现的 ZIP 虚拟机执行。ZIP 源自 Clocksin 1984 年的顺序 Prolog 抽象机论文,项目目标是让同一程序以更少指令和内存运行,若 MVP 成功将成为 trilog 的后端。
报道正文
zipc (working title)
The goal of the project is to scaffold the VM to a degree where I can compare it with the current trilog runtime.
A compiler from Prolog to the ZIP virtual machine, and the VM itself, in C. ZIP is the abstract machine from Clocksin's Design and Simulation of a Sequential Prolog Machine (1984); the papers are in doc/.
zipc is meant to become the backend of trilog if the MVP succeeds, or just stay as a faster separate Prolog compilable runtime, I am not really sure yet. Either way, trilog interprets clauses as terms with the ABC algorithm, and compiling them to ZIP should make the same programs run in fewer instructions and less memory, which should help with trilog's main target.
The compiler is written in Prolog and runs on Scryer Prolog. It writes a binary image, which the VM in src/ loads and runs.