Document workspace ownership, resource semantics and agent lifecycle
This commit is contained in:
@@ -21,27 +21,46 @@
|
||||
|
||||
```ebnf
|
||||
program = { use-decl }, declaration, { declaration }, EOF ;
|
||||
declaration = class-decl | function-decl ;
|
||||
declaration = class-decl | function-decl | agent-decl ;
|
||||
|
||||
use-decl = "use", namespace-key ;
|
||||
namespace-key = user-handle, ":", namespace-path ;
|
||||
namespace-key = workspace-handle, ":", namespace-path ;
|
||||
namespace-path = identifier, { ".", identifier } ;
|
||||
```
|
||||
|
||||
user-handle 是系统认可的唯一用户名,由身份规则提供,不等同于源码 identifier。代码自身的归属通过外部上下文提供,程序文法中没有自身 namespace 声明。
|
||||
workspace-handle 是系统认可的唯一 workspace 名称,由平台命名规则提供,不等同于源码 identifier 或操作用户的登录标识。代码自身的归属通过外部上下文提供,程序文法中没有自身 namespace 声明。
|
||||
|
||||
相关说明:[namespace](../guide/03-namespaces.md)、[程序结构与导入](../guide/04-program-structure.md)。
|
||||
|
||||
角色和 r/w/x 是平台授权模型,不增加 use 参数、源码权限位或逐函数的权限声明。代码可视域的具体语法另行定义,见[用户身份与 workspace 权限](../guide/02-user-identity.md)。
|
||||
|
||||
## 类与类型
|
||||
|
||||
```ebnf
|
||||
class-decl = "class", identifier, "{", { field-decl }, "}" ;
|
||||
class-decl = "class", identifier, "{", { class-member }, "}" ;
|
||||
class-member = field-decl | function-decl ;
|
||||
field-decl = identifier, ":", type-name ;
|
||||
type-name = identifier ;
|
||||
```
|
||||
|
||||
相关说明:[类型与类](../guide/07-types-and-classes.md)。
|
||||
|
||||
成员函数沿用 function 声明骨架;接收者、实例关联和类内名称查找未由这条产生式确定。
|
||||
|
||||
## Agent 声明骨架
|
||||
|
||||
```ebnf
|
||||
agent-decl = "agent", identifier, "{", { agent-member }, "}" ;
|
||||
agent-member = field-decl | binding | function-decl
|
||||
| class-decl | agent-decl ;
|
||||
```
|
||||
|
||||
此骨架是复用共有成员的语法提案,不是完整 agent 文法。工具关联、memory、state、路由、中断和上下文处理的专门关系尚未定义,不将这些职责名自动列为关键字或固定字段。成员中的表达式通过绑定或函数体出现,不能从允许共有成员推导任意语句可出现在任意位置。
|
||||
|
||||
agent 和 class 内部的名称查找、可见性、成员初始化及实例关联另行定义。骨架能表达成员函数,但未决定工具暴露范围;binding 仍只说明初始绑定,不决定重新赋值或共享状态。
|
||||
|
||||
相关说明:[Agent](../guide/13-agents.md)、[规范状态](specification-status.md#agent)。
|
||||
|
||||
## 函数与绑定
|
||||
|
||||
```ebnf
|
||||
@@ -57,6 +76,8 @@ return-stmt = "return", expression ;
|
||||
|
||||
本基本函数体文法只包含绑定和末尾返回,不覆盖完整控制流或独立表达式语句。
|
||||
|
||||
变量可以改变引用目标的语言模型已经确定,但可变变量声明、重新赋值和 let 可重绑性尚未确定,故不在此添加赋值产生式。
|
||||
|
||||
相关说明:[表达式与绑定](../guide/08-expressions-and-bindings.md)、[函数与调用](../guide/09-functions-and-calls.md)。
|
||||
|
||||
## 表达式
|
||||
|
||||
Reference in New Issue
Block a user