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.
翻译:非公理推理系统(NARS)为构建在知识和资源不足条件下运行的适应性代理提供了框架。然而,标准输入语言Narsese存在可用性障碍:其密集的符号表示法、过载的标点符号以及隐式约定使得程序难以阅读、编写和维护。我们提出DriftScript,一种编译为Narsese的类Lisp领域专用语言。DriftScript提供源级结构,涵盖非公理逻辑(NAL)第1至8层中使用的主要语句和词项形式,包括继承、时序蕴含、变量量化、顺序合取以及操作调用,同时用可读的关键词驱动的S表达式替换符号性语法。编译器是一个无依赖、四阶段的流水线,用1,941行C99实现。当与DriftNARS引擎配合使用时,DriftScript程序通过四种结构化回调类型和一个HTTP操作注册表连接到外部系统,从而实现自主代理的感知-推理-行动循环。我们描述了语言设计和形式文法,详述了编译器架构,并通过包含106个案例的测试套件、与手写Narsese的等价性测试、NAL覆盖分析、结构可读性指标以及编译基准测试对编译器进行了评估。源代码可在https://github.com/seamus-brady/DriftNARS获取。本文聚焦于DriftScript语言的设计与实现及其在DriftNARS中的嵌入,而非NARS本身的新推理算法。