[ANN] MatchTool

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

[ANN] MatchTool

Uko2
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.


Cheers!
Uko
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Nicolai Hess-3-2
Hey Uko,

this pattern for a message sent:

`@msg:`@args

can match message sends with or without arguments, so it matches both

1 squared.
and
1 raisedTo:2

The problem is that the first match "1 squared" will give  a DNU on the right pane, as the argument var '@args is empty.



2016-08-04 10:23 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.


Cheers!
Uko

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Nicolai Hess-3-2


2016-08-04 11:38 GMT+02:00 Nicolai Hess <[hidden email]>:
Hey Uko,

this pattern for a message sent:

`@msg:`@args

can match message sends with or without arguments, so it matches both

1 squared.
and
1 raisedTo:2

The problem is that the first match "1 squared" will give  a DNU on the right pane, as the argument var '@args is empty.


And if you match a method, it can happen that the keys <-> values in the map are actually strings or text and not a pattern variable
(-source--, -pragma-, and the pattern method selector).

 


2016-08-04 10:23 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.


Cheers!
Uko


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Uko2
Thank you for the feedback Nicolai!

I will take a look as soon as I get back home :)

Cheers. 
Uko

Sent from my iPhone

On 04 Aug 2016, at 11:56, Nicolai Hess <[hidden email]> wrote:



2016-08-04 11:38 GMT+02:00 Nicolai Hess <[hidden email]>:
Hey Uko,

this pattern for a message sent:

`@msg:`@args

can match message sends with or without arguments, so it matches both

1 squared.
and
1 raisedTo:2

The problem is that the first match "1 squared" will give  a DNU on the right pane, as the argument var '@args is empty.


And if you match a method, it can happen that the keys <-> values in the map are actually strings or text and not a pattern variable
(-source--, -pragma-, and the pattern method selector).

 


2016-08-04 10:23 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.

<Screen Shot 2016-08-01 at 13.40.49.png>

Cheers!
Uko


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

abergel
In reply to this post by Uko2
This is very cool Uko.
I suggest to have a list of small examples, one click away from the main UI.

Alexandre


> On Aug 4, 2016, at 4:23 AM, Yuriy Tymchuk <[hidden email]> wrote:
>
> Hi everyone!
>
> I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
> You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
> The tool is available for Pharo 6 from the catalog.
>
> <Screen Shot 2016-08-01 at 13.40.49.png>
>
> Cheers!
> Uko

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

stepharo
In reply to this post by Uko2

really nice.

Stef


Le 4/8/16 à 10:23, Yuriy Tymchuk a écrit :
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.


Cheers!
Uko

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

stepharo
In reply to this post by Uko2

BTW our experience with anne and JC when they tried to document how the patterns were working is that there are some situations

that are not clear, and this is why Camille and Mark started to work on another solution.

I hope to get to know more soom.


Stef


Le 4/8/16 à 10:23, Yuriy Tymchuk a écrit :
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.


Cheers!
Uko

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Uko2
In reply to this post by Nicolai Hess-3-2
Yes, I have fixed that, but forgot to merge the development branch :). The latest version should work.

Uko

On 04 Aug 2016, at 11:56, Nicolai Hess <[hidden email]> wrote:



2016-08-04 11:38 GMT+02:00 Nicolai Hess <[hidden email]>:
Hey Uko,

this pattern for a message sent:

`@msg:`@args

can match message sends with or without arguments, so it matches both

1 squared.
and
1 raisedTo:2

The problem is that the first match "1 squared" will give  a DNU on the right pane, as the argument var '@args is empty.


And if you match a method, it can happen that the keys <-> values in the map are actually strings or text and not a pattern variable
(-source--, -pragma-, and the pattern method selector).

 


2016-08-04 10:23 GMT+02:00 Yuriy Tymchuk <[hidden email]>:
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.

<Screen Shot 2016-08-01 at 13.40.49.png>

Cheers!
Uko



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Uko2
In reply to this post by abergel

> On 04 Aug 2016, at 13:34, Alexandre Bergel <[hidden email]> wrote:
>
> This is very cool Uko.

Thank you.

> I suggest to have a list of small examples, one click away from the main UI.

Good point, I’ll add this to my TODO list.

Uko

>
> Alexandre
>
>
>> On Aug 4, 2016, at 4:23 AM, Yuriy Tymchuk <[hidden email]> wrote:
>>
>> Hi everyone!
>>
>> I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
>> You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
>> The tool is available for Pharo 6 from the catalog.
>>
>> <Screen Shot 2016-08-01 at 13.40.49.png>
>>
>> Cheers!
>> Uko
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Mark Rizun

BTW our experience with anne and JC when they tried to document how the patterns were working is that there are some situations

that are not clear, and this is why Camille and Mark started to work on another solution. 

I hope to get to know more soom. 


There will be a presentation during ESUG. So, see you there :) 

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

Uko2
In reply to this post by stepharo
I know about all that, and I’ve tried to discuss about some kind of collaboration, but it didn’t work out.

RBPattern nodes are straight-forward. The are just a Smalltalk code with special nodes. The problem about them is that it is not clear what is happening, because you have to create a LintRule which creates one more Rule which creates an AST node, and then it traverses an AST and changes it in the same time… for me it was a lot of mess. I moved to the lowest level and introduces a really simple API:

matchNode := RBPatternParser parseExpression: aMatchString.
matchNode
match: anASTNode
onSuccess: [ :map | “do something with a mapping" ]
onFailure: [ “do something in case of failure” ]

And you can easily debug this, and other tools can use this, for example match tool does:

testAST nodesDo: [ :node | “try to match node” ]

so I can look for all possible matches.


I’ve heard that Camille and Mark are making something super generic for matching objects, but my problem is that I need to give people possibility to make their rules easy, and each time I ask if I can use something there is still work in progress.

There is another problem: for now I have no use case for matching objects, I have a prototype of rules about objects, but sadly it’s out of my scope. Then how easy is the syntax? RBPatternCode is the closest you can get to Smalltalk code, if we give people another syntax they will have to learn something new and will resist. Finally what infrastructure do we have around it? I always use rubular.com when I need to work with regex, and now I will always use MatchTool when I need to work with the pattern code. Is there any support for inspecting the matches from the new framework?

So in the end I’m always ready for collaboration and always looking for collaboration, but at the moment I don’t need some super-powerful matching framework. I need something easy for people to use, and this is why I’m refactoring rules and implementing tools like this. And it seems easier for me to fix a bug in pattern code matching (especially as it is easier to debug it) than adopting a new framework.

Another example. MatchTool should definitely marry RewriteTool, because after you’ve investigated the matches you should be able to say: "ok, and now I want to transform this”, and then you enter another expression and save a rule. In fact RewriteTool inspired me a lot. Because it is very useful, but you enter code and it is not highlighted, so you have no clue if you made a mistake. Or you create a “meta variable” and you want to know what are these `@ things and you have to google. Or your code is finally matching, but you have no idea what was matched to what. I really hate when I have no clue what is happening, and this is why I’ve implemented MatchTool.

Cheers.
Uko


On 04 Aug 2016, at 13:45, stepharo <[hidden email]> wrote:

BTW our experience with anne and JC when they tried to document how the patterns were working is that there are some situations

that are not clear, and this is why Camille and Mark started to work on another solution.

I hope to get to know more soom.


Stef


Le 4/8/16 à 10:23, Yuriy Tymchuk a écrit :
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.

<Mail Attachment.png>

Cheers!
Uko


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] MatchTool

stepharo



Le 4/8/16 à 14:27, Yuriy Tymchuk a écrit :
I know about all that, and I’ve tried to discuss about some kind of collaboration, but it didn’t work out.

this is not a problem :)

RBPattern nodes are straight-forward. The are just a Smalltalk code with special nodes.
Indeed
The problem about them is that it is not clear what is happening,
Yes it killed me often in the past.
I would like to have something super simple to be able to write rules.
because you have to create a LintRule which creates one more Rule which creates an AST node, and then it traverses an AST and changes it in the same time… for me it was a lot of mess. I moved to the lowest level and introduces a really simple API:

matchNode := RBPatternParser parseExpression: aMatchString.
matchNode
match: anASTNode
onSuccess: [ :map | “do something with a mapping" ]
onFailure: [ “do something in case of failure” ]
good.
Gustavo may be interested by your work.

And you can easily debug this, and other tools can use this, for example match tool does:

testAST nodesDo: [ :node | “try to match node” ]

so I can look for all possible matches.

It is sad that I did not record precisely the problems that anne and JC encountered.
Because now I forgot but it basically kills the enrrgy to write a nice chapter on how to use the rules
so this is good that your tool is making easier to work with them.

I’ve heard that Camille and Mark are making something super generic for matching objects, but my problem is that I need to give people possibility to make their rules easy, and each time I ask if I can use something there is still work in progress.

Sure my point was not to say not to do it and to use the system of Mark and Camille :)

There is another problem: for now I have no use case for matching objects, I have a prototype of rules about objects, but sadly it’s out of my scope.
we should let them deliver and we will see.
Then how easy is the syntax? RBPatternCode is the closest you can get to Smalltalk code, if we give people another syntax they will have to learn something new and will resist.
We will see. May be we can clone your tool and use their matcher.
Finally what infrastructure do we have around it? I always use rubular.com when I need to work with regex, and now I will always use MatchTool when I need to work with the pattern code.
We should integrate your tool to the system :)
Is there any support for inspecting the matches from the new framework?
I do not think so.

So in the end I’m always ready for collaboration and always looking for collaboration, but at the moment I don’t need some super-powerful matching framework.
For me I need something that I can understand and I can use. The problem is that with RB I never could :).
I got always frustrated because I forgot a . or @t
This is why I asked Mark to work on the rewrite tools using direct manipulation.
I need something easy for people to use, and this is why I’m refactoring rules and implementing tools like this. And it seems easier for me to fix a bug in pattern code matching (especially as it is easier to debug it) than adopting a new framework.
Ok now Anne and JC got frustrated by it. If you can understand it then it is probably the way to go for you.

Another example. MatchTool should definitely marry RewriteTool, because after you’ve investigated the matches you should be able to say: "ok, and now I want to transform this”, and then you enter another expression and save a rule. In fact RewriteTool inspired me a lot. Because it is very useful, but you enter code and it is not highlighted, so you have no clue if you made a mistake. Or you create a “meta variable” and you want to know what are these `@ things and you have to google. Or your code is finally matching, but you have no idea what was matched to what.
:) same experience here. So often I was doing everything by hand and frustrated
I really hate when I have no clue what is happening, and this is why I’ve implemented MatchTool.
Yes please. I'm sure that mark would be happy to get his tool more used.


Cheers.
Uko


On 04 Aug 2016, at 13:45, stepharo <[hidden email]> wrote:

BTW our experience with anne and JC when they tried to document how the patterns were working is that there are some situations

that are not clear, and this is why Camille and Mark started to work on another solution.

I hope to get to know more soom.


Stef


Le 4/8/16 à 10:23, Yuriy Tymchuk a écrit :
Hi everyone!

I’m happy to announce a new tool that can help you to understand to the pattern code is working in match & rewrite rules.
You can read more on my blogpost: http://blog.yuriy.tymch.uk/2016/08/matchtool.html
The tool is available for Pharo 6 from the catalog.

<Mail Attachment.png>

Cheers!
Uko