diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-09-22 00:16:21 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-09-22 00:16:21 -0700 |
commit | 08c2f2a5ce0a55c1b33314309ab857d305a0e58b (patch) | |
tree | e50605d4c4a11599c8abbc13e58e52da44f1677b /subx/apps | |
parent | 3f8597bc3d44ab26536b080ae00e3b66202137d6 (diff) | |
download | mu-08c2f2a5ce0a55c1b33314309ab857d305a0e58b.tar.gz |
4587
Diffstat (limited to 'subx/apps')
-rw-r--r-- | subx/apps/factorial.k2 | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/subx/apps/factorial.k2 b/subx/apps/factorial.k2 deleted file mode 100644 index 82c44352..00000000 --- a/subx/apps/factorial.k2 +++ /dev/null @@ -1,21 +0,0 @@ -fn factorial n : int -> result/EAX : int [ - result/EAX <- copy 1 - { - compare n, 1 - break-if <= - var tmp/EBX : int - tmp/EBX <- copy n - tmp/EBX <- subtract 1 - var tmp2/EAX : int - tmp2/EAX <- call factorial, tmp/EBX - result/EAX <- multiply tmp2/EAX, n - } - return result/EAX -] - -data structures: - -add entry for "factorial" into the Types table, with value (fn int -> int) -add entry for "factorial" into the address table, with value next available address -add entry for "factorial" into the size table, with value size of "0b 0a bb ..." -increase next available address by size of "factorial" |