docs: 更新 README.md
This commit is contained in:
parent
26a533adaf
commit
a52a941799
56
README.md
56
README.md
@ -100,20 +100,20 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
|
||||
4. **运行成功**
|
||||
|
||||
``` snow
|
||||
`````snow
|
||||
## 编译器输出
|
||||
### Snow 源代码
|
||||
#### Main.snow
|
||||
module: Main
|
||||
import:Math
|
||||
function: main
|
||||
return_type: void
|
||||
return_type: int
|
||||
body:
|
||||
Math.add(6,1)
|
||||
return 0
|
||||
end body
|
||||
end function
|
||||
end module
|
||||
|
||||
#### Math.snow
|
||||
module: Math
|
||||
function: add
|
||||
@ -144,7 +144,7 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
"parameters": [
|
||||
|
||||
],
|
||||
"returnType": "void",
|
||||
"returnType": "int",
|
||||
"body": [
|
||||
{
|
||||
"type": "ExpressionStatement",
|
||||
@ -169,6 +169,13 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Return",
|
||||
"value": {
|
||||
"type": "NumberLiteral",
|
||||
"value": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -221,12 +228,15 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
%0 = CONST 6
|
||||
%1 = CONST 1
|
||||
%2 = CALL Math.add, %0, %1
|
||||
%3 = CONST 0
|
||||
RET %3
|
||||
}
|
||||
func add(%0, %1) {
|
||||
%2 = ADD_I32 %0, %1
|
||||
RET %2
|
||||
}
|
||||
|
||||
|
||||
### VM code
|
||||
0000: I_PUSH 6
|
||||
0001: I_STORE 0
|
||||
@ -234,26 +244,36 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
0003: I_STORE 1
|
||||
0004: I_LOAD 0
|
||||
0005: I_LOAD 1
|
||||
0006: CALL 8 2
|
||||
0006: CALL 12 2
|
||||
0007: I_STORE 2
|
||||
0008: I_LOAD 0
|
||||
0009: I_LOAD 1
|
||||
0010: I_ADD
|
||||
0011: I_STORE 2
|
||||
0012: I_LOAD 2
|
||||
0013: RET
|
||||
0008: I_PUSH 0
|
||||
0009: I_STORE 3
|
||||
0010: I_LOAD 3
|
||||
0011: HALT
|
||||
0012: I_LOAD 0
|
||||
0013: I_LOAD 1
|
||||
0014: I_ADD
|
||||
0015: I_STORE 2
|
||||
0016: I_LOAD 2
|
||||
0017: RET
|
||||
Written to D:\Devs\IdeaProjects\Snow\target\Demo1.water
|
||||
|
||||
=== Launching VM ===
|
||||
Calling function at address: 8
|
||||
Calling function at address: 12
|
||||
Return 7
|
||||
Return 2147483647
|
||||
Operand Stack state:[7]
|
||||
Process has ended
|
||||
|
||||
Operand Stack state:[0]
|
||||
|
||||
--- Call Stack State ---
|
||||
|
||||
Local variable table is empty
|
||||
```
|
||||
|
||||
### VM Local Variable Table:
|
||||
0: 6
|
||||
1: 1
|
||||
2: 7
|
||||
3: 0
|
||||
`````
|
||||
|
||||
## 编译Snow源代码
|
||||
|
||||
@ -269,13 +289,13 @@ Snow 语言受到 LLM 驱动代码生成趋势的启发,强调简单而清晰的
|
||||
* **单个文件编译:**
|
||||
|
||||
```bash
|
||||
Snow [SnowCode].snow
|
||||
Snow complete [SnowCode].snow
|
||||
```
|
||||
|
||||
* **多个文件编译:**
|
||||
|
||||
```bash
|
||||
Snow [SnowCode1].snow [SnowCode2].snow [SnowCode3].snow
|
||||
Snow complete [SnowCode1].snow [SnowCode2].snow [SnowCode3].snow -o [Name]
|
||||
```
|
||||
|
||||
* **目录递归编译:**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user