Michael Steil, the guy who did the Pear dynarec for Macs and who discussed the
recompiler howto in his document, has written a recompiler for Apple I and
Commodore. I discovered this when reading about the restoration of Apple I
basic ( http://www.pagetable.com/?p=35 ) which led to a similar article about
Commodore basic. Steil hasn't posted the Apple basic translation online but he
does have the Commodore one online at Sourceforge
(http://cbmbasic.sourceforge.net/ ) which you can fetch and look at with svn.
He hasn't posted the recompiler, but looking at the translated code it would
appear that he is using LLVM ( http://llvm.org/ ) as a back end.
Not that the translated code looks all that great yet, but using an optimising
compiler backend is exactly the way to go. You can tell from the comments that
he is handling a proper data flow graph which should allow for global
optimisation (the clue is the references to 'phi nodes', which won't mean much
unless you've done some advanced compiler reading)
Apple 1 basic is a 4K file. He hasn't posted the source of the translated
version, though a lot of people are asking for it. I thought it might be fun to
push it through Orion and see what it looks like. There are a couple of partial
disassemblies of apple1 basic out there already (although reportedly not 100%
accurate copies of the code) which will give most of the labels and jumps.
G