Add view, positional args, errors gold, and bytecode backend.
Reorganize examples into structure/keywords/errors, launch marqdo view for AST-backed browsing, and ship an M5 stack VM selectable via --backend. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a29bf6e97b
commit
ac0a3fbced
48 files changed
+3007
-202
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# Marqdo examples(金样例)
|
||||
|
||||
本目录即测试夹具,见 [doc/design/examples-and-tests.md](../doc/design/examples-and-tests.md)。
|
||||
|
||||
| 目录 | 内容 |
|
||||
|------|------|
|
||||
| [`structure/`](structure/) | 函数、调用、分支、循环、表、导入、位置实参 |
|
||||
| [`keywords/`](keywords/) | `print`、布尔与 `and`/`or`/`not` |
|
||||
| [`errors/`](errors/) | 期望失败(未定义名 / 未知函数 / 实参 / 语法) |
|
||||
|
||||
```bash
|
||||
cargo test
|
||||
marqdo run examples/structure/hello.mq.md
|
||||
marqdo view examples
|
||||
```
|
||||
Whitespace-only changes.
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: bad arity
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> needs_one
|
||||
|
||||
## needs_one
|
||||
- x
|
||||
|
||||
> print text=`x`
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: unrecognized code line
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
~not-valid-syntax
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: undefined variable
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> print text=`missing`
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: unknown function
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> no_such_fn x=1
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: 布尔与逻辑关键字
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
*`a` = True*
|
||||
*`b` = False*
|
||||
|
||||
+ `a` and not `b`
|
||||
> print text=ok
|
||||
+ *
|
||||
> print text=fail
|
||||
|
||||
*`probe` = 1*
|
||||
|
||||
+ None
|
||||
> print text=none-truthy
|
||||
+ *
|
||||
> print text=none-falsy
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
title: 内置 print
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
> print text=named form
|
||||
|
||||
> print positional
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: 位置实参
|
||||
description: `> fn value` binds by parameter order; named form still works
|
||||
---
|
||||
|
||||
# main
|
||||
|
||||
位置实参:
|
||||
|
||||
> 问候 Marqdo
|
||||
|
||||
具名实参(保留):
|
||||
|
||||
> 问候 谁=World
|
||||
|
||||
## 问候
|
||||
- 谁
|
||||
|
||||
> print text=Hello `谁`!
|
||||
Reference in new issue
Block a user