Skip to content

Rewriting with metadata #272

@ViciousDoormat

Description

@ViciousDoormat

Hello,

Is it possible to make a rewrite rule that uses metadata?
For example, when I interface the struct

struct ExprWithContext
    head::Any
    args::Vector{Any}
    context::Int
end

with MT, can I somehow make a rewrite rule that for example does id(x) --> <context value> with as starting term for example ExprWithContext(:id, [:x], 5). I does not need to be this syntax or this example, but a way to use metadata in rewrite rules would be amazing.

Somewhat related, I also saw in the ale/3.0 lambda_theory.jl tutorial on line 177 that you can make rewrite rules that utilize EGraph Analysis information. I was wondering how exactly this works. Specifically, I was wondering where the _egraph variable comes from.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions