DriftScript: A Domain-Specific Language for Programming Non-Axiomatic Reasoning Agents

arXiv cs.AI / 4/2/2026

💬 OpinionIdeas & Deep AnalysisTools & Practical UsageModels & Research

Key Points

  • The paper introduces DriftScript, a Lisp-like domain-specific language that compiles into Narsese to make Non-Axiomatic Reasoning Systems (NARS) programs more readable and maintainable.
  • DriftScript provides source-level constructs for key Non-Axiomatic Logic (NAL) sentence and term forms across levels 1–8, using keyword-based S-expressions to replace dense symbolic punctuation-heavy syntax.
  • The compiler is implemented as a zero-dependency four-stage pipeline in 1,941 lines of C99, with a formal grammar and language design described in the work.
  • Integrated with the DriftNARS engine, DriftScript supports structured callback types and an HTTP operation registry to enable a sense-reason-act loop for autonomous agents connecting to external systems.
  • The authors evaluate the approach with a 106-case test suite, equivalence testing versus hand-written Narsese, NAL coverage analysis, readability metrics, and compilation benchmarks, and publish the code on GitHub.

Abstract

Non-Axiomatic Reasoning Systems (NARS) provide a framework for building adaptive agents that operate under insufficient knowledge and resources. However, the standard input language, Narsese, poses a usability barrier: its dense symbolic notation, overloaded punctuation, and implicit conventions make programs difficult to read, write, and maintain. We present DriftScript, a Lisp-like domain-specific language that compiles to Narsese. DriftScript provides source-level constructs covering the major sentence and term forms used in Non-Axiomatic Logic (NAL) levels 1 through 8, including inheritance, temporal implication, variable quantification, sequential conjunction, and operation invocation, while replacing symbolic syntax with readable keyword-based S-expressions. The compiler is a zero-dependency, four-stage pipeline implemented in 1,941 lines of C99. When used with the DriftNARS engine, DriftScript programs connect to external systems through four structured callback types and an HTTP operation registry, enabling a sense-reason-act loop for autonomous agents. We describe the language design and formal grammar, detail the compiler architecture, and evaluate the compiler through a 106-case test suite, equivalence testing against hand-written Narsese, a NAL coverage analysis, structural readability metrics, and compilation benchmarks. The source code is available at https://github.com/seamus-brady/DriftNARS. This paper focuses on the design and implementation of the DriftScript language and its embedding into DriftNARS, rather than on new inference algorithms for NARS itself.