Yard/test.erpn

56 lines
613 B
Plaintext
Raw Normal View History

2023-01-02 11:06:24 +00:00
extern function say_hello
extern function print
extern function println
2023-05-03 10:46:27 +00:00
extern function readline
2023-01-02 11:56:53 +00:00
extern function to_rat
2023-01-02 11:06:24 +00:00
2023-01-02 11:56:53 +00:00
extern function to_int
extern function parse_int
extern function parse_rat
2023-01-02 11:06:24 +00:00
2023-05-03 10:46:27 +00:00
extern function cos
extern function pow
extern function sin
extern function tan
extern function ln
extern function sqrt
2023-01-02 11:06:24 +00:00
fac:
Load Arg x
2023-05-03 10:46:27 +00:00
Load Int 2
Gt Num(Int)
2023-01-02 11:06:24 +00:00
Unless
Load Int 1
Yield
Load Arg x
Load Int 1
Sub Int
Call fac
Load Arg x
2023-05-03 10:46:27 +00:00
Load Int 2
Sub Int
Call fac
Add Int
2023-01-02 11:56:53 +00:00
2022-12-06 14:02:03 +00:00
main:
2023-05-03 10:46:27 +00:00
Load Int 24
2023-01-02 11:56:53 +00:00
Call fac
2023-05-03 10:46:27 +00:00
Store Int c
Load String "factorial: "
Load Var c
2023-01-02 11:56:53 +00:00
Cat Str
Call println
2022-12-06 14:02:03 +00:00
Load Int 0