Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro committed Oct 27, 2021
1 parent edfa891 commit 918e1cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/EGraphs/ematch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ function instantiate(g::EGraph, pat::PatTerm, sub::Sub, rule::AbstractRule)
ar = arity(pat)

T = gettermtype(g, op, ar)
println(T)
children = map(x -> instantiate(g, x, sub, rule), arguments(pat))
similarterm(T, op, children; exprhead=eh)
end


## ====================== EMatching Machine =======================

mutable struct Machine
g::EGraph
Expand Down
7 changes: 3 additions & 4 deletions src/ematch_compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ function compile_pat!(reg, p::PatTerm, prog)
c = memsize(prog)
nargs = arity(p)
# registers unit range
a = c:(c + nargs - 1)
regrange = c:(c + nargs - 1)

exhead = exprhead(p)
op = operation(p)
Expand All @@ -173,9 +173,8 @@ function compile_pat!(reg, p::PatTerm, prog)

increment(prog, nargs)


push!(prog.instructions, Bind(reg, ENodePat(exhead, op, a, checkop)))
for (reg, p2) in zip(a, arguments(p))
push!(prog.instructions, Bind(reg, ENodePat(exhead, op, regrange, checkop)))
for (reg, p2) in zip(regrange, arguments(p))
compile_pat!(reg, p2, prog)
end
end
Expand Down

2 comments on commit 918e1cd

@0x0f0f0f
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

  • Fixes for SymbolicUtils integration
  • Egraph pattern matcher can now match against symbol and function objects at the same time

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/47588

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.0 -m "<description of version>" 918e1cd220fd0a6eb6987845fd19577bf43dd7ce
git push origin v1.1.0

Please sign in to comment.