Normally I added some text in french :(
do not pay attention too much on the style 
dump information and like that we can get material to work on
I think that having examples is the key point to get started.


> 
> On 4 November 2010 10:09, Stéphane Ducasse <[email protected]> wrote:
>> I'm adding some other files (in french) :(
>> but I'm stuck with git....
> 
> git pull
> git add french-rewrite.tex
> git commit
> git push
> 
>>> Yeah, where do I find that chapter?
>>> 
>>> There is a section on the AST matching/search in my PhD as Helvetia
>>> builds on top of it. Not on the AST rewriting though, Helvetia uses a
>>> different mechanism there. Still it might be a good start.
>>> 
>>> Lukas
>>> 
>>> On 4 November 2010 09:49, Stéphane Ducasse <[email protected]> 
>>> wrote:
>>>> lukas
>>>> 
>>>> I would love to have a chapter on Rules. I have a starter that I wrote 
>>>> long time ago for the squeak french book
>>>> but it would be cool if you could add to it.
>>>> 
>>>> Stef
>>>> 
>>>> On Nov 4, 2010, at 12:55 AM, Lukas Renggli wrote:
>>>> 
>>>>>> If I try to match it like:
>>>>>>  '`...@browser showOn: `...@target; from: `...@origin; using: [ 
>>>>>> `...@browser `[email protected]]'
>>>>> 
>>>>> The match expression
>>>>> 
>>>>>    `...@browser `[email protected]
>>>>> 
>>>>> doesn't make sense. Statements (.) cannot be a message selector that
>>>>> would be expected after a receiver. Also, you cannot have a selector
>>>>> list (@) if you don't give also an argument list to match. So the
>>>>> closest valid thing is
>>>>> 
>>>>>    `...@browser `message
>>>>> 
>>>>> which looks for unary message sends (recursive is not necessary here
>>>>> either, because there is nothing to recurse into), or
>>>>> 
>>>>>    `...@browser `...@message: `...@message
>>>>> 
>>>>> which looks for arbitrary message sends and recursively into all 
>>>>> arguments.
>>>>> 
>>>>>> It seems to only get those appearances which contain a single appearance 
>>>>>> of browser inside the block.
>>>>> 
>>>>> As I wrote in the previous mail you need to do it with nested
>>>>> rewrites. Inside the block you match for any sequence of statements:
>>>>> 
>>>>>    `[email protected]
>>>>> 
>>>>> And as replacement you use the `{ :context | ... } trick to perform a
>>>>> new rewrite somehow along the following untested lines:
>>>>> 
>>>>>    `{ :context |
>>>>>        RBParseTreeRewriter new
>>>>>            " replace whatever matched to `...@browser with the variable a 
>>>>> "
>>>>>            replaceTree: (context at: '`...@browser') with: (RBParser
>>>>> parseExpression: 'a');
>>>>>            " execute on the list of statements "
>>>>>            executeTree: (context at: '`[email protected]');
>>>>>            " return the rewritten tree "
>>>>>            tree }
>>>>> 
>>>>> Cheers,
>>>>> Lukas
>>>>> 
>>>>> --
>>>>> Lukas Renggli
>>>>> www.lukas-renggli.ch
>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Lukas Renggli
>>> www.lukas-renggli.ch
>>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Lukas Renggli
> www.lukas-renggli.ch
> 


Reply via email to