14 See that "0000003" at the end of the float?
15 Floating point numbers /suck/, we only use them because
16 computers were small and slow. Now that they are large
17 (sixty-four bits per word!? Holy shit!) and fast, so
18 floating point is no longer necessary.
20 (However, in practice, we will still be using it, because
21 it's been turd-polished to such a high sheen. GPUs are
22 monsters! But most of us have no use for supercomputers
23 outside of playing fancy games.)
25 ---------------------------------------
30 With a little bit of complexity we could improve efficiency (e.g. using
31 VList instead of singly-linked list.) But I want to tackle efficiency by
32 compilation, and write the compiler(s) in Prolog. I think that avoids
33 complexity compared to intricating the guts of the interpreter by hand,
34 and moves the unavoidable complexity into formal statements of logic that
35 can be evaluated by machine (aka Prolog.)
37 ---------------------------------------
39 So how do we want to handle definitions? Read a defs.txt file at
40 compile time? Build defs.c from defs.txt?
43 defname(JoyListPtr stack, JoyListPtr expression)
45 def_node = some C initializer?
46 def_node = text_to_expression("dup mul");
47 push_quote(def_node, expression);
52 I think the easiest thing to do at the mo' would be to hardcode the defs
53 as an array of strings and then read them and convert at start time?
67 /*char *text = (char *)TEXT;*/
68 /*mpz_init_set_str(pi, "3141592653589793238462643383279502884", 10);*/
69 /*mpz_init_set_str(pi, "25d0c79fe247f31777d922627a74624", 16);*/
70 /*GC_register_finalizer(pi, my_callback, NULL, NULL, NULL);*/
72 /*el = push_integer_from_str("3141592653589793238462643383279502884", 0);*/
73 /*el->tail = text_to_expression(text);*/
74 /*el = text_to_expression(text);*/
91 pop_any(), pop_int(), and add
93 With cmp (provided by the GMP lib) we can implement the rest of
94 the comparison functions as definitions:
97 eq [false] [true] [false] cmp
98 gt [true] [false] [false] cmp
99 lt [false] [false] [true] cmp
100 neq [true] [false] [true] cmp
101 le [false] [true] [true] cmp
102 ge [true] [true] [false] cmp
126 ----------------------------------
127 Argh! That was brutal.
129 I hate staring at the thing that SHOULD work and it just fucking doesn't work.
131 Why? Because some fuck-wit somewhere decided to fuck up how things have always been done.
133 https://stackoverflow.com/questions/12734161/how-to-use-boehm-garbage-collector-in-ubuntu-12-04
135 > To answer my own question: actually, the Boehm GC library still works the same way as it used to in 12.04. The problem is that GCC doesn't! GCC has started to default to --as-needed, and it drops -lgc completely if it is at the beginning of the line. This is a very major change!!
137 > Solution is to move -lgc to the end:
143 > gcc -Wl,--as-needed -lgc test.c