56 lines
613 B
Plaintext
56 lines
613 B
Plaintext
extern function say_hello
|
|
|
|
extern function print
|
|
|
|
extern function println
|
|
|
|
extern function readline
|
|
|
|
extern function to_rat
|
|
|
|
extern function to_int
|
|
|
|
extern function parse_int
|
|
|
|
extern function parse_rat
|
|
|
|
extern function cos
|
|
|
|
extern function pow
|
|
|
|
extern function sin
|
|
|
|
extern function tan
|
|
|
|
extern function ln
|
|
|
|
extern function sqrt
|
|
|
|
fac:
|
|
Load Arg x
|
|
Load Int 2
|
|
Gt Num(Int)
|
|
Unless
|
|
Load Int 1
|
|
Yield
|
|
Load Arg x
|
|
Load Int 1
|
|
Sub Int
|
|
Call fac
|
|
Load Arg x
|
|
Load Int 2
|
|
Sub Int
|
|
Call fac
|
|
Add Int
|
|
|
|
main:
|
|
Load Int 24
|
|
Call fac
|
|
Store Int c
|
|
Load String "factorial: "
|
|
Load Var c
|
|
Cat Str
|
|
Call println
|
|
Load Int 0
|
|
|