Compiler modifications 
Author Message
 Compiler modifications

As anyone modified the VW compiler so that you can pass in a dictionary
from which to look up temporary variables?  Some of our objects has "code"
associated with them that needs to be compiled and executed.
Unfortunately, we need to pass in a dictionary of variable names<->values
because we can't use temporary or global variables.

Russ McClelland

--
Persistence is futile.
You will be aggregated...



Sun, 19 Sep 1999 03:00:00 GMT  
 Compiler modifications


Quote:
>As anyone modified the VW compiler so that you can pass in a dictionary
>from which to look up temporary variables?  Some of our objects has "code"
>associated with them that needs to be compiled and executed.
>Unfortunately, we need to pass in a dictionary of variable names<->values
>because we can't use temporary or global variables.

Yes, I have.  The following method illustrates how I do it, although
it may not be quite right.  I modified the following, from a method
in my debug package.  The method belongs to a subclass of Compiler.
Basically, you see that what you want accomplished is done by modifying
the variable scope.

compileDoIt: textOrStream from: anEditor notifying: aRequestor ifFail: failBlock

        | methodNode method lastLocalScope staticScope scope1 |
        class := "You must fill this in"
        lastLocalScope := NameScope forClass: class."This line may not be quite right."
        [lastLocalScope outerScope class == StaticScope]
                whileFalse: [lastLocalScope := lastLocalScope outerScope].
        staticScope := lastLocalScope outerScope.
        scope1 := StaticScope variables: variableDictionary.    "Here is the dictionary"
        lastLocalScope outerScope: scope1.
        self from: textOrStream
                class: class
                context: scope
                notifying: aRequestor.
        [methodNode := self translate: sourceStream noPattern: true ifFail: [^failBlock value]]
                valueNowOrOnUnwindDo: [lastLocalScope outerScope: staticScope].
        method := methodNode generate.
        ^method

===========================================================
Terry Raymond       Smalltalk Professional Debug Package
Crafted Smalltalk   *Breakpoints* and *Watchpoints* for
19 Tilley Ave.                  VW and ENVY/Developer
Newport, RI  02840

http://www.craftedsmalltalk.com
===========================================================



Tue, 21 Sep 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. extracting 2 lines with modifications

2. Modification to APL2 RANK operator

3. C++ source macro modification

4. Number Modification?

5. Adrian Davis' setcsv with modifications

6. [ST/X] SUnit Modifications 2.7.5 and TestRunner

7. Styled text modifications

8. color modifications

9. Batch Modifications / CSH Scripts

10. Collection item modification

11. - Setting the creation/modification date for files - HOW ?

12. Icon List Modification

 

 
Powered by phpBB® Forum Software