The ocaml interpreted compiler slowly prods along at an unfortunate speed. By now, I have to admit I just hate ocaml, if it can't handle recursion, they should have published that.
Gave up on this whole strategy all together. I can get to the point it gives the lambda terms and I have a runtime, so, I am gonna take a zillion steps back and write a basic lambda evaluator in glorious dependable C.
030410: Worked my way through yy and y files. That was fun and easy, it compiles and generates an AST.
030510: Hit the evaluation problem again, there are not trivial schemes which give very good performance. Opted for applicative order evaluation based on substitution - the assumption being that you end up reducing/substituting in the head mostly, which will for the better part be small terms, while the rest is fully reduced. It will break sometimes. Read a 1996 Brics paper -to no avail- for better schemes.
030710: Evaluation works, gonna patch the bindings to C in. Tomorrow kids. Day after, patch the emitter also, thought it through, I might waste too much memory on lists of lists of characters as it stands anyway.
030810: Working on two laptops now. The ML interpreted compiler takes a looong time to get to the emitting stage, at which point it will have allocated 200Mb, and, after which, it stalls while growing to 1.3+ Gb of memory. I patched the emitter to emit collections of lines directly to a file as to avoid the memory explosion, and one laptop is bravely ploughing through the source code. But, unless I get lucky and the bootstrap works in one translation, the compile times are just prohibitive to debug. So, I am writing the simple lambda interpreter at the second laptop, which is a bit of a waste too, since I am only writing it to throw it away after the bootstrap.
030910: It's annoying writing the nth lamda-evaluator, so I find myself playing famville, hoping that the ML compiler bootstraps...
030910: Guess its another milestone, the ML interpreted to C compiler emitted C. Lots of it.
030910: It's bloody unbelievable. I manage to choke gcc with a whopping 400K lines, 18M chars of input.
030910: Ooops, mistake. I was `tail'-ing the output of the Makefile, thought it stalled. Uh, some stuff works. If I strip out some comments I end up with 14M source. Not sure, the binary size -without semantic checks- is 9M on a 64 bit system. Okish I guess, half of GHC.
Gnu, Flex and Bisons. Yay, farmville!
No comments:
Post a Comment