What I was wondering is how Silverlight does support these super-cool dynamic languages 'on-the-fly'. After some fiddling, this is what I think how it works:
- 'Non-real' CLR languages like IronPython or IronRuby have a parser which converts the source code to a language-specific abstract syntax tree (AST).
- The language specific AST is transformed to a language-independent dynamic language runtime (DLR) AST.
- DLR's code generation converts the DLR AST to IL code using Reflection.Emit (and Light-Weight Code Generation [LCG]). A delegate is created pointing to the new DynamicMethod.
- The delegate is finally invoked.
[This is a comment from John Lam] That's right. You could theoretically go straight to the DLR AST but experience shows that it's too hard to understand without going through a language specific AST first. IronRuby, JScript, and VB are all implemented this way as well.
Posted by: Christian Weyer | 05/04/2007 at 02:31 AM