Skip to content

Commit 139d864

Browse files
committed
新增「控制流:跳转、循环与迭代器」章节
讲解跳转改写 next_instr、if/else 条件跳转、while 回跳、for 的迭代器协议(GET_ITER/FOR_ITER),以及 block 栈与 break/continue
1 parent c27e3cd commit 139d864

9 files changed

Lines changed: 439 additions & 3 deletions

File tree

.vitepress/config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export default defineConfig({
7272
items: [
7373
{ text: 'Python 虚拟机框架(帧对象与求值循环)', link: '/vm/frame-and-eval-loop/' },
7474
{ text: '一般表达式与名字空间', link: '/vm/expressions-and-names/' },
75-
{ text: '控制流:跳转、循环与迭代器(编写中…)', link: '/' }
75+
{ text: '控制流:跳转、循环与迭代器', link: '/vm/control-flow/' },
76+
{ text: '异常机制:block 栈与栈展开(编写中…)', link: '/' }
7677
]
7778
},
7879
{

SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
- [Python 虚拟机框架(帧对象与求值循环)](vm/frame-and-eval-loop/index.md)
3333
- [一般表达式与名字空间](vm/expressions-and-names/index.md)
34-
- 控制流:跳转、循环与迭代器
34+
- [控制流:跳转、循环与迭代器](vm/control-flow/index.md)
3535
- 异常机制:block 栈与栈展开
3636
- 函数机制:调用、参数与闭包
3737
- 生成器与协程

index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
- [ ] 第 4 部分:虚拟机
3333
- [x] Python 虚拟机框架(帧对象与求值循环)
3434
- [x] 一般表达式与名字空间
35-
- [ ] 控制流:跳转、循环与迭代器
35+
- [x] 控制流:跳转、循环与迭代器
3636
- [ ] 异常机制:block 栈与栈展开
3737
- [ ] 函数机制:调用、参数与闭包
3838
- [ ] 生成器与协程

vm/control-flow/block-stack.svg

Lines changed: 50 additions & 0 deletions
Loading

vm/control-flow/for-iter.svg

Lines changed: 63 additions & 0 deletions
Loading

vm/control-flow/if-else.svg

Lines changed: 51 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)