Config file and CLI arg parser.

This commit is contained in:
Simon Forman
2018-07-21 17:56:53 -07:00
parent ca06c626e1
commit 33a952ff71
9 changed files with 428 additions and 47 deletions
+53
View File
@@ -0,0 +1,53 @@
[key bindings]
<F5> = swap
<F6> = dup
<Shift-F5> = roll<
<Shift-F6> = roll>
<F7> = over
<Shift-F7> = tuck
<F8> = parse
<F12> = words
<F1> = reset_log show_log
<Escape> = clear reset_log show_log
<Control-Delete> = pop
<Control-i> = i
[Definitions]
of = swap at
product = 1 swap [*] step
flatten = [] swap [concat] step
quoted = [unit] dip
unquoted = [i] dip
enstacken = stack [clear] dip
? = dup truthy
disenstacken = ? [uncons ?] loop pop
dinfrirst = dip infra first
nullary = [stack] dinfrirst
unary = nullary popd
binary = nullary [popop] dip
ternary = unary [popop] dip
pam = [i] map
run = [] swap infra
sqr = dup mul
size = 0 swap [pop ++] step
fork = [i] app2
cleave = fork [popd] dip
average = [sum 1.0 *] [size] cleave /
gcd = 1 [tuck modulus dup 0 >] loop pop
least_fraction = dup [gcd] infra [div] concat map
*fraction = [uncons] dip uncons [swap] dip concat [*] infra [*] dip cons
*fraction0 = concat [[swap] dip * [*] dip] infra
down_to_zero = [0 >] [dup --] while
range_to_zero = unit [down_to_zero] infra
anamorphism = [pop []] swap [dip swons] genrec
range = [0 <=] [1 - dup] anamorphism
while = swap [nullary] cons dup dipd concat loop
dupdipd = dup dipd
primrec = [i] genrec
step_zero = 0 roll> step
codireco = cons dip rest cons
make_generator = [codireco] ccons
ifte = [nullary not] dipd branch