Scripted Compiler Discussions

WHD: DOS C compilers used to offer in-line assembly language as a matter or course. Why shouldn't a scripting language offer in-line C as a matter of course?

AK: We already have inline-C with CriTcl, but that calls an external compiler, gcc for now. The secondary question is more about calling the/a scripted compiler, directly loaded into the language interpreter.

WHD: True. It would be nice to have CriTcl's functionality while dispensing with any kind of external compiler. But other than providing an easy way to inline C in a Tcl script, what good would a scripted compiler be? E.g., how would you use scripts to change the compiler's behavior?

AK: I was less thinking about changing its behaviour and more of making use of highlevel data structures available in scripting languages to make the implementation of algorithms for data-flow analysis and such more ... understandable and/or maintainable.


AK: Comments on parsing C and other languages. The text processing capabilities of scripting languages can make this part easier as well. string map, regsub, split, etc. are powerful tools. Use the first, for example to the detect the various types of tokens and insert marker characters for separation. After this pre-tokenization phase we can listify the string into the token-list via split. Easy, fast, ... This takes care of the lexer. Parsing ... Yeti, or similar

Ro: I've never really put much time in learning all that arcana... especially since Tcl makes it dead easy to write config files as Tcl ;) Use the source Luke ;)

AK: Well, the comment above are not about config-files, but the scripted compiler for C, etc. Also useful in Tools like Source Navigator which extract xref information out of sources.