Align package and executable names with workspace directories
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 15m7s
Verify databases and deploy Aster VM / verify-and-deploy (push) Successful in 15m7s
This commit is contained in:
@@ -23,7 +23,7 @@ Python 代码中的 `def greet(name): ...` 创建的是语言函数。函数需
|
||||
CPython 的 `len`、`print` 等宿主实现的内建函数则通过 C 函数入口调用。Endor 使用 Rust,所以命名为 `EndorNativeFunctionObject`,不把 C 写入名称。
|
||||
|
||||
```rust
|
||||
use aster_core::{EndorNativeFunctionObject, Value, Vm, VmError};
|
||||
use endor_core::{EndorNativeFunctionObject, Value, Vm, VmError};
|
||||
|
||||
fn echo(arguments: &[Value]) -> Result<Value, VmError> {
|
||||
match arguments {
|
||||
@@ -58,9 +58,9 @@ Native 函数和语言函数均通过 `Vm::call(&mut self, ...)` 调用。语言
|
||||
| Complex | 复数记录 | 实部与虚部各自的 Integer、Decimal、Rational 或 BinaryFloat 表示 |
|
||||
|
||||
```rust
|
||||
use aster_core::{EndorNumber, Value};
|
||||
use endor_core::{EndorNumber, Value};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let id = EndorNumber::integer("1234567890123456789012345678901234567890")?;
|
||||
let amount = EndorNumber::decimal("12345678901234567890.000100")?;
|
||||
let ratio = EndorNumber::rational("1", "3")?;
|
||||
@@ -105,9 +105,9 @@ print(read()) # updated
|
||||
`read` 与 `write` 必须引用同一个变量位置。若各自复制一份 `x` 的初始值,write 重新赋值后 read 就看不到变化。Cell 是这个共享位置:函数持有 Cell,Cell 持有当前值。外层函数返回后,Cell 仍被闭包持有。
|
||||
|
||||
```rust
|
||||
use aster_core::{Value, Vm};
|
||||
use endor_core::{Value, Vm};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let mut vm = Vm::new()?;
|
||||
let cell = vm.new_cell(None)?; // 空槽,不是 Nil。
|
||||
vm.cell_set(cell, Value::Text("first".into()))?;
|
||||
|
||||
@@ -94,9 +94,9 @@ Vm::execute(code, globals)
|
||||
## 最小示例
|
||||
|
||||
```rust
|
||||
use aster_core::{CodeLayout, EndorCode, Instruction, Opcode, Value, Vm};
|
||||
use endor_core::{CodeLayout, EndorCode, Instruction, Opcode, Value, Vm};
|
||||
|
||||
fn main() -> Result<(), aster_core::VmError> {
|
||||
fn main() -> Result<(), endor_core::VmError> {
|
||||
let mut vm = Vm::new()?;
|
||||
let globals = vm.new_dict()?;
|
||||
let code = EndorCode::from_instructions(
|
||||
|
||||
Reference in New Issue
Block a user