MUMPS 76 入门指南 – 周年纪念版
The MUMPS 76 Primer – anniversary edition

原始链接: https://github.com/rochus-keller/MUMPS/blob/main/docs/MUMPS_Primer.adoc

本词汇表概述了 MUMPS 编程语言的核心技术架构与语法。主要组成部分包括: * **变量**:MUMPS 使用**局部变量**(进程专用,驻留内存)和**全局变量**(持久化,存储于磁盘,以 `^` 前缀标识)。这些变量以具有**下标**的层次化**节点**形式组织。**裸指示器**(Naked Indicator)通过记忆之前的引用来优化全局访问。 * **执行与结构**:程序由**例程**(由**标签**标识的行)组成。执行由**分区**(进程上下文)管理,其中包括用于流程控制的**例程堆栈**。流程通过使用**入口引用**的 `DO` 和 `GOTO` 等命令进行导向。 * **逻辑与数据**:所有数据均被视为**字符串**。逻辑依赖于**测试开关**(`$TEST`),它用于追踪条件运算的结果。**后置条件**(Post-conditionals)允许实现简洁的内联逻辑执行。 * **系统交互**:**特殊变量**(以 `$` 为前缀)提供系统状态信息,而**超时**机制管理外部设备交互。**$DATA**($D)属性用于指示节点状态,反映该节点是否包含值或子节点。 该环境提供了一种针对特定进程执行上下文进行优化的持久化、基于树形结构的数据模型。

为庆祝 MUMPS 编程语言周年纪念,Rochus Keller 发布了一本《MUMPS 76 入门指南》以及一个包含该经典语言解释器的项目。MUMPS 于 1966 年在麻省总医院开发,其独特之处在于语言与数据库的深度集成,在 NoSQL 一词出现前便已成为该技术的早期形式。 这一发布引发了用户关于 Caché 和 IRIS 等系统遗产的讨论。一位贡献者分享了他们使用该语言进行“代码降临”(Advent of Code)挑战的经验,强调了其生态系统“妙不可言的诅咒”特性。参与者指出,该平台的优势在于其“后关系型”方法,能够在同一环境中提供多种数据处理范式,包括对象、SQL 和原始全局访问。尽管该语言历史悠久,但其高效性和非传统的架构理念至今仍令人着迷。
相关文章

原文
Ascending Order

For integer subscripts, the natural numeric order: 0, 1, 2, 3, …​ For strings, the ASCII collating sequence.

Caret

The ^ character (ASCII 94). Prefixes global variable names.

Current Device

The I/O device to which READ and WRITE are directed. Identified by $IO. Changed by USE.

D Attribute

An integer (0, 1, 10, or 11) associated with each node in the variable tree, returned by $DATA. Encodes whether the node has a defined value (units digit) and whether it has descendants (tens digit).

Entry Reference

A specification of a line in a routine, used by DO, GOTO, and $TEXT. May include a label, an offset, and a routine name.

Global Variable

A variable whose name begins with ^. Stored persistently on disk, shared among all processes, and organized as a hierarchical tree.

Label

A name or integer literal at the beginning of a line that identifies the line for reference by DO, GOTO, or $TEXT.

Level Indicator (Line Level)

In the 1976 standard, a dot-based notation (not used in NBS 118 but present in some implementations) to indicate block structure.

Local Variable

A variable without the ^ prefix. Exists only in the current process’s memory; lost when the process terminates.

Naked Indicator

A hidden register that remembers the global name and all but the last subscript of the most recently executed global reference. Used to interpret naked references of the form ^(subscript).

Naked Reference

A global variable reference of the form ^(expr[,…​]) that relies on the Naked Indicator for the global name and leading subscripts.

Node

A point in the variable tree identified by a name and zero or more subscripts. Each node may have a value, descendants, both, or neither.

Partition

In the MUMPS system model, the execution context of a single process, containing local variables, the routine stack, the Test Switch, and the Naked Indicator.

Post-Conditional

A :tvexpr appended to a command word or (for DO, GOTO, XECUTE) an argument, which causes conditional execution without affecting $TEST.

Routine

The unit of program storage and interchange. Consists of a routine head (the routine name) followed by a routine body (a sequence of lines).

Routine Stack

A stack that records return points for DO and XECUTE calls. QUIT pops the stack.

Scope (of FOR or IF)

The remainder of the current line. FOR and IF control execution of everything to their right on the same line.

Special Variable

A read-only system variable prefixed with $ (e.g., $HOROLOG, $TEST). Provides access to system state.

Storage Reference

A syntactic construct denoting a variable node: either a local variable name, a global variable name, or a naked reference, any of which may be subscripted.

String

The sole data type in MUMPS. All values, including numbers, are represented as character strings.

Subscript

An expression enclosed in parentheses after a variable name, used to select a descendant node. Multiple subscripts, separated by commas, identify a path through the tree.

Test Switch

A Boolean register (0 or 1) whose content is available via $TEST. Set by IF (with arguments), and by OPEN, LOCK, and READ when a timeout is used.

Timeout

A :numexpr appended to arguments of READ, OPEN, or LOCK, specifying a maximum wait time in seconds. Sets $TEST on completion.

Truth Value

0 (false) or 1 (true). The truth-value interpretation of any string is: take its numeric interpretation; if the result is 0, the truth value is 0; otherwise it is 1.

联系我们 contact @ memedata.com