arXiv:2604.00043cs.PLcs.AI2026-04

用易读的Lisp语法编写智能体推理程序,让非公理推理更高效。

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

  • 采用关键词式S表达式替代复杂符号,提升代码可读性
  • 支持从逻辑1到8级的核心语句形式,覆盖继承与时序推理
  • 适配自主智能体系统,适合想快速开发推理模块的研究者

非公理推理系统(NARS)为资源与知识不足下的自适应智能体提供框架,但其输入语言Narsese因符号密集、标点多重、隐含约定而难写难读。本文提出DriftScript,一种类Lisp的领域专用语言,可编译为Narsese。该语言覆盖非公理逻辑(NAL)1至8级的主要句式与术语形式,包括继承、时序蕴含、变量量化、序列合取及操作调用,并以可读的关键词型S表达式替代符号语法。编译器为零依赖、四阶段流水线,实现于1,941行C99代码。结合DriftNARS引擎,DriftScript程序通过四种结构化回调类型与HTTP操作注册表连接外部系统,支持感知-推理-行动闭环。本文描述语言设计与形式语法,详述编译器架构,并通过106个案例测试集、手写Narsese等价性验证、NAL覆盖率分析、结构可读性度量及编译性能基准进行评估。源码见https://github.com/seamus-brady/DriftNARS。本文聚焦DriftScript设计与在DriftNARS中的集成,不涉及NARS新推理算法。

原文摘要 · Abstract (English)

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.

逻辑编程智能体系统领域语言

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。