JDelekto: It's really cool to actually see the source from the "tokenized" result. What would be even more cool, is to do something like a "peephole optimizer" for the tokens based on certain patterns of tokens and see if your de-tokenizer would end up writing source code that is either more cryptic or more elegant.
I actually have the LST files which are the source code, which i used to do a raw compare against the output in these to ensure the detokenized results were correct... I also loaded up the BAS files, treated them as cassette tapes and just CLOAD-ed them up which let me check stuff i wasn't sure if the output was right or not... (
Which was awesome!! :) )
As for optimizers, yes that could easily be done, but it would probably be heavily based on 1:1 input, a known set of better code... Although it's far more likely that converting it to 6502 code would have a much better result...
Reminds me.. I wrote a quick little BASIC program to draw a circle since the graphics modes were simple and didn't require anything special to get going... And honestly floating point work (
Especially SIN/COS/TAN) is
SLLLOOOWWWW!, the largest speedups involved saving the results or re-using the SIN/COS results rather than re-calculating them. So a peep-hole optimizer might be useful, but better coding is going to get a much better result...
Reminds me... Later i'm considering disassembling the entire BASIC rom and figuring out how it all works, perhaps make a presentation for it...
JDelekto: Actually, you should take a look at asm.js and Emscripten --they've done some really creative ports of applications to JavaScript that actually run fairly well on modern hardware.
Not to mention more recent versions of Firefox have pushed more a JIT recompiler for Javascript to make it run faster... Or was that written with D? I forget...