A minimalistic programming language written in C89.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

74 řádky
1.7 KiB

fn potato do sys.trace return end
fn print_n_utf8_impl do
start:
-1 + swap print_utf8
dup start swap jump_if
end
fn potato2 do
start:
-1 + dup
65 print_utf8 10 print_utf8
start swap jump_if
end
fn potato3 do
start:
-1 + dup
66 print_utf8 10 print_utf8
start swap jump_if
end
# Encrypts things by doing `(v + add_key) % modulo_key`
#
# @param array An array of ints representing a string
# @param add_key Should be lower than the add key
# @param modulo_key Should ke higher than all the codepoints of the array
#
# array add_key modulo_key
fn encrypt do
3 pluck array.size
# array add_key modulo_key index
loop:
1 - dup 5 pluck
# array add_key modulo_key index index array
array.index
# array add_key modulo_key index v
4 pluck +
# array add_key modulo_key index (v + add_key)
3 pluck %
# array add_key modulo_key index ((v + add_key) % modulo_key)
2 pluck
# array add_key modulo_key index ((v + add_key) % modulo_key) index
6 pluck
# array add_key modulo_key index ((v + add_key) % modulo_key) index array
array.set
# array add_key modulo_key index
dup 0 != loop jump_if drop drop drop drop
end
# Prints a string as an array of ints
#
# @param array An array of ints representing a string
#
# array
fn string.dump do
dup array.size 0
# array end it
91 print_utf8
32 print_utf8
loop:
dup
# array end it it
4 pluck
# array end it it array
array.index print_int
32 print_utf8
1 +
# array end it
2 pluck 2 pluck > loop jump_if
# array end it
93 print_utf8
drop drop drop
end