从零实现JSVMP
从零JSVMP
JSCode ——> Ast——> 指令 ——> 执行指令
简单的解释器
1 |
|
- 2*5
- 10+8
- console.log(18)
mul 2,5
add 10,8
print 18
栈的形式
- push 2
- push 5
- mul
- push 8
- add
**栈: 先进后出 **
- push
- mul
- add
得到指令集 > [1,2,1,5,2,1,8,3,4]
2*5*8+2*3
得到指令集 > [1,2,1,5,2,1,8,2,1,2,1,3,2,3,4]
从零实现JSVMP
https://hybpjx.cn/2024/08/23/从零实现JSVMP/