A ZIP-style Prolog VM for trilog github.com · 15 points · 4 comments · HN thread...

@best

A ZIP-style Prolog VM for trilog github.com · 15 points · 4 comments · HN thread

TL;DR The author of zipc describes a Prolog-to-ZIP compiler and virtual machine written in C, aimed at comparing against the existing trilog runtime. ZIP is the abstract machine from Clocksin's 1984 thesis on a sequential Prolog machine. The compiler itself is written in Prolog and runs on Scryer Prolog, producing a binary image that the C VM loads and executes.

  • zipc is a compiler from Prolog to the ZIP abstract machine plus a VM implemented in C.
  • ZIP comes from Clocksin's 1984 work 'Design and Simulation of a Sequential Prolog Machine', whose papers are included in the repo's doc/ folder.
  • The project's stated goal is to scaffold the VM enough to benchmark it against the current trilog runtime.
  • The compiler is written in Prolog and runs on Scryer Prolog, writing a binary image that the VM in src/ loads.
  • If the MVP succeeds, zipc may become trilog's backend; otherwise it could remain a separate, faster Prolog runtime. The author is undecided.
  • The author expects compiling trilog's clauses to ZIP to need fewer instructions and less memory than trilog's current ABC-based term interpretation.

Discussion The thread is short and mostly drifts away from the project into the general question of whether Prolog still has modern uses. One commenter calls Prolog an interesting language they studied at university and asks about current applications. Replies point to its traditional strength in searching over incomplete data, with one comparing it to database-style exact querying versus looser web search. The mood is curious and conversational, with little technical engagement with the VM itself.

  • Prolog's original search and constraint use still applies (some): Commenters argue Prolog suits finding all possible paths through incomplete data. One notes that SQL struggles when relationships are one-way or missing.
  • Prolog is mechanical like a database, unlike AI search (a few): One commenter compares Prolog's exact, fully explained results to database queries, while contrasting them with the tolerant, approximate results of web search and modern AI.
  • Prolog is interesting mainly as an academic subject (a few): The original poster frames Prolog as a curiosity from university courses and asks whether it has practical use today.
  • GOFAI may be relevant background for modern AI (a few): One commenter asks whether studying symbolic AI is a useful prerequisite for LLMs and generative AI, without a clear answer in the thread.

#prolog #compilers #virtualMachines #scryerProlog #trilog