Execution Assisted Code Converter

As I am working on my VBScript.net and ASP Classic Compiler, I came the realization why the existing asp classic to ASP.NET converters do not work very well. The primary difficulty is those converter do not get many type information during static analysis when converting a scripting language such as VBScript to strongly-typed VB.NET or C#. For the same reason, editor intellisence usually does not go very far when editing VBScript or Javascript.

Executing the dynamic code will bring in the type information at runtime. I think that I just need to enhance my callsite binder to capture some information and then I will be able to convert the code that flow through my binder much more accurately. Mostly likely the converted code should work correctly right away. So I will just give it a name called Execution Assisted Code Converter. I will try to put together a prototype if I get a little bit of time.

Note: There are refinements to the thought through discussions of this post below.

1 Comment

  • Dave, thank you for your sharing your experience. That helps me to refine my thought.

    After parsing a VBScript, I got an abstract syntax tree (AST). I can write a simple interpreter (rather than using the DLR compiler). As I walk (interpret)over the tree, I will record type info on my tree node/symbol table. Then I can generate the C#/VB.NET code by dumping the AST with the recorded type info.

    If a variable is used to store more than one type, I would have to declare them as object and case/convert them when the variable is reference. If I add convention/dictionary assistance as you mentioned, I can make assumption of type at front and attempt conversion when assigned (instead of when referenced). That would certainly be a significant improvement to the code generator.

Comments have been disabled for this content.