[[ [Scripted Compiler] :: '''Code generation''' ]] ---- Nothing concrete here yet. References * compilers & interpreters archive -- runtime code generation subject area [http://www.dcs.qmul.ac.uk/SEL-HPC/Articles/GeneratedHtml/comp.rcg.html] * compilers & interpreters archive -- general code generation techniques subject area [http://www.dcs.qmul.ac.uk/SEL-HPC/Articles/GeneratedHtml/comp.gen.html] * [Cameron Laird]'s Regular Expressions Column [http://regularexpressions.com] talked in April 2004 about 'Rapid Development of An Assembler Using Python' [http://www.unixreview.com/documents/s=2472/ur0404e/]. Also coded in [Python], and therefore scriptable in it, is Atul Varma's "Mini-C Compiler" [http://people.cs.uchicago.edu/~varmaa/mini_c/]. Keyword: BURS - Bottom Up Rewrite System - Related to LR parsing. ---- '''Discussions''' [AK]: The runtime assembler/code-generator [Lightning] (written in C) is GPL, the concept however can be used to generate machine code from within Tcl, plus some bits to write [ELF], [COFF], etc. libraries the low-level backend would be done. [jcw]: ''Too much machinery - I'd generate raw into a bytearray. Store it that way too. ELF is for linkers and other arcane concepts '' [AK]: Do not forget pre-compiling of binaries. Even if the compiler is in an extension I do not want to deliver it with every application. Especially not wrapped applications.. [jcw]: ''Absolutely. Which is why I said: "store it that way too".'' [AK]: Hm, sort of like tbcload, but machine code ? ... A mixture of bytecode and machine code might be of interest. A loader format containing binary data in a script language wrapper ... Oh, I just remember [Oberon]'s ''[Slim Binaries]''. These store a portable AST of the input (not bytecode) and use a simple compiler/mapper to machine code when loading. Lower-level than Tcl bytecodes, and are still as efficient as machine code, because in the end they are machine-code. I think I will start a new thread below to collect and merge the thoughts into something cohesive. ---- Softwire: http://softwire.sourceforge.net/ (LGPL) See also [tcc], which can compile and run C in core, but also knows about ELF. ---- [[ [Scripted Compiler] :: '''Code generation''' ]]