4.5 compiler

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

4.5 compiler

Trygve
I'm still trying to port my BabyIDE (my DCI programming environment) from 3.10.2 to 4.5. The stumbling block is that my 3.10.2 compiler hacks do not work in 4.5.  I posted a request for help on 2014.11.29. For some reason, that message got garbled and was hard to understand.

Since then, I have isolated the problem into the attached files that reconstruct the problem independently of the rest of BabyIDE.
The files should be filed in in sequence: RoleMethods.st, BB1RoleNode-3.5.st, Encoder-#BabyIDE-4.5.st.

    RoleMethods.st 

is the class with the method that shall be compiled:
    RoleMethods>>transferFrom  
        self increase: AMOUNT. 
       ^true
 An extension makes the Encoder understand that AMOUNT is a very special variable and adds it as a BB1RoleNode to the parse tree:

    BB1RoleNode-3.5.st
    Encoder-#BabyIDE-4.5.st

BB1RoleNode is a new VariableNode. It acts a kind of preprocessor that translates the reference to AMOUNT into a runtime lookup. This lookup can be seen by decompiling the CompiledMethod. This is what makes DCI master the runtime.

The 3.10.2 versions work in 3.10.2. The 4.5 versions compile the source with a couple of old halts. (May be they are warnings because the BB1RoleNode is a mixture of VariableNode and MessageNode). The result after proceeds is a CompiledMethod.  It's faulty and cannot be decompiled. The decompiled code should read
   
    RoleMethods>>transferFrom
       self increase: (BB1ContextStack playerForRole: #AMOUNT)
        ^true

I hope the above is sufficient for you to find my bug(s).

Thanks
--Trygve



16-Squeak7179-filein.zip (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 4.5 compiler

Nicolai Hess
Hi Trygve,

I slightly changed the code for using the BB1RoleNode class.
Instead of modifying the encoder scope table, I put this code
in the method for parsing (global-)variables :

Encoder>>encodeVariable: name sourceRange: range ifUnknown: action

Now I can use the current encoder in the BB1RoleNode class and use it to create
an Literal entry for the literal set :

BB1RoleNode>>asVariable: roleName contextName: ctxNam withEncoder: enc
...
enc encodeLiteral: roleName asSymbol.


And I changed the receiver VariableNode to a LiteralVariableNode, it looks like
the sizeCodeForValue: works now.


nicolai





2014-12-07 12:42 GMT+01:00 Trygve Reenskaug <[hidden email]>:
I'm still trying to port my BabyIDE (my DCI programming environment) from 3.10.2 to 4.5. The stumbling block is that my 3.10.2 compiler hacks do not work in 4.5.  I posted a request for help on 2014.11.29. For some reason, that message got garbled and was hard to understand.

Since then, I have isolated the problem into the attached files that reconstruct the problem independently of the rest of BabyIDE.
The files should be filed in in sequence: RoleMethods.st, BB1RoleNode-3.5.st, Encoder-#BabyIDE-4.5.st.

    RoleMethods.st 

is the class with the method that shall be compiled:
    RoleMethods>>transferFrom  
        self increase: AMOUNT. 
       ^true
 An extension makes the Encoder understand that AMOUNT is a very special variable and adds it as a BB1RoleNode to the parse tree:

    BB1RoleNode-3.5.st
    Encoder-#BabyIDE-4.5.st

BB1RoleNode is a new VariableNode. It acts a kind of preprocessor that translates the reference to AMOUNT into a runtime lookup. This lookup can be seen by decompiling the CompiledMethod. This is what makes DCI master the runtime.

The 3.10.2 versions work in 3.10.2. The 4.5 versions compile the source with a couple of old halts. (May be they are warnings because the BB1RoleNode is a mixture of VariableNode and MessageNode). The result after proceeds is a CompiledMethod.  It's faulty and cannot be decompiled. The decompiled code should read
   
    RoleMethods>>transferFrom
       self increase: (BB1ContextStack playerForRole: #AMOUNT)
        ^true

I hope the above is sufficient for you to find my bug(s).

Thanks
--Trygve







role_methods_wrapper.2.cs (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 4.5 compiler

Trygve
THANK YOU!!

On 08.12.2014 08:21, Nicolai Hess wrote:
Hi Trygve,

I slightly changed the code for using the BB1RoleNode class.
Instead of modifying the encoder scope table, I put this code
in the method for parsing (global-)variables :

Encoder>>encodeVariable: name sourceRange: range ifUnknown: action

Now I can use the current encoder in the BB1RoleNode class and use it to create
an Literal entry for the literal set :

BB1RoleNode>>asVariable: roleName contextName: ctxNam withEncoder: enc
...
enc encodeLiteral: roleName asSymbol.


And I changed the receiver VariableNode to a LiteralVariableNode, it looks like
the sizeCodeForValue: works now.


nicolai





2014-12-07 12:42 GMT+01:00 Trygve Reenskaug <[hidden email]>:
I'm still trying to port my BabyIDE (my DCI programming environment) from 3.10.2 to 4.5. The stumbling block is that my 3.10.2 compiler hacks do not work in 4.5.  I posted a request for help on 2014.11.29. For some reason, that message got garbled and was hard to understand.

Since then, I have isolated the problem into the attached files that reconstruct the problem independently of the rest of BabyIDE.
The files should be filed in in sequence: RoleMethods.st, BB1RoleNode-3.5.st, Encoder-#BabyIDE-4.5.st.

    RoleMethods.st 

is the class with the method that shall be compiled:
    RoleMethods>>transferFrom  
        self increase: AMOUNT. 
       ^true
 An extension makes the Encoder understand that AMOUNT is a very special variable and adds it as a BB1RoleNode to the parse tree:

    BB1RoleNode-3.5.st
    Encoder-#BabyIDE-4.5.st

BB1RoleNode is a new VariableNode. It acts a kind of preprocessor that translates the reference to AMOUNT into a runtime lookup. This lookup can be seen by decompiling the CompiledMethod. This is what makes DCI master the runtime.

The 3.10.2 versions work in 3.10.2. The 4.5 versions compile the source with a couple of old halts. (May be they are warnings because the BB1RoleNode is a mixture of VariableNode and MessageNode). The result after proceeds is a CompiledMethod.  It's faulty and cannot be decompiled. The decompiled code should read
   
    RoleMethods>>transferFrom
       self increase: (BB1ContextStack playerForRole: #AMOUNT)
        ^true

I hope the above is sufficient for you to find my bug(s).

Thanks
--Trygve







    

--

Trygve Reenskaug      mailto: [hidden email]
Morgedalsvn. 5A       http://folk.uio.no/trygver/
N-0378 Oslo             http://fullOO.info
Norway                     Tel: (+47) 22 49 57 27