Compile::discover_locals now takes a Vec<SpExpr> instead of a single SpExpr. It is also called before the compiler starts building the list of instructions so that all names in the scope are available at compile-time. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
27 lines
315 B
Plaintext
27 lines
315 B
Plaintext
[ :x x x ] :dup
|
|
|
|
[
|
|
dup!
|
|
[dup! 1 -! factorial! *!]
|
|
[:_ 1]
|
|
if!
|
|
]
|
|
:factorial
|
|
|
|
[
|
|
dup! print!
|
|
"! = " print!
|
|
factorial!
|
|
println!
|
|
]
|
|
:do-factorial
|
|
|
|
1 do-factorial!
|
|
2 do-factorial!
|
|
3 do-factorial!
|
|
4 do-factorial!
|
|
5 do-factorial!
|
|
6 do-factorial!
|
|
7 do-factorial!
|
|
8 do-factorial!
|
|
9 do-factorial! |