What is a "predicate" in the AST matcher?

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

What is a "predicate" in the AST matcher?

David Chisnall via cfe-dev
For example in this sentence:
AST matchers are predicates on nodes in the AST.
Or this:
LibASTMatchers provides a domain specific language to create predicates on Clang’s AST.

Can someone help to explain what predicates are?

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: What is a "predicate" in the AST matcher?

David Chisnall via cfe-dev
The word "predicate" here is used in its mathematical sense: https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)

All this really means is that each individual matcher is a function that accept an AST node and return either true ("matches") or false ("doesn't match").

On 7/2/20 11:03 PM, Yafei Liu via cfe-dev wrote:
For example in this sentence:
AST matchers are predicates on nodes in the AST.
Or this:
LibASTMatchers provides a domain specific language to create predicates on Clang’s AST.

Can someone help to explain what predicates are?

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: What is a "predicate" in the AST matcher?

David Chisnall via cfe-dev
Thanks Artem!

On Fri, Jul 3, 2020 at 2:22 PM Artem Dergachev <[hidden email]> wrote:
The word "predicate" here is used in its mathematical sense: https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)

All this really means is that each individual matcher is a function that accept an AST node and return either true ("matches") or false ("doesn't match").

On 7/2/20 11:03 PM, Yafei Liu via cfe-dev wrote:
For example in this sentence:
AST matchers are predicates on nodes in the AST.
Or this:
LibASTMatchers provides a domain specific language to create predicates on Clang’s AST.

Can someone help to explain what predicates are?

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev