You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FixedShapedSolver produces solutions by manipulated a fixed shaped tree. Such fixed shaped trees are a hybrid of two types:
RuleNode
StateFixedShapedHole
When next_solution! is called, the previous solution is lost and re-manipulated into a new solution. This is intended behavior as this approach to reduce the number of allocations: trees are never copied but reused.
In the current version of Herb, it is not possible to interpret a StateFixedShapedHole directly. So after finding a solution, the tree is converted to rule nodes using statefixedshapedhole2rulenode.
Why is this needed
To reduce to number memory allocations, stop using statefixedshapedhole2rulenode
Target implementation
Implementing rulenode2expr(hole::StateFixedShapedHole, grammar::Grammar) should be straight forward:
Ignore rulenode._val
Instead of using rulenode.ind, use get_rule(hole)
Instead of using rulenode.children, use get_children(hole)
The text was updated successfully, but these errors were encountered:
The
FixedShapedSolver
produces solutions by manipulated a fixed shaped tree. Such fixed shaped trees are a hybrid of two types:RuleNode
StateFixedShapedHole
When
next_solution!
is called, the previous solution is lost and re-manipulated into a new solution. This is intended behavior as this approach to reduce the number of allocations: trees are never copied but reused.In the current version of Herb, it is not possible to interpret a
StateFixedShapedHole
directly. So after finding a solution, the tree is converted to rule nodes usingstatefixedshapedhole2rulenode
.Why is this needed
To reduce to number memory allocations, stop using
statefixedshapedhole2rulenode
Target implementation
Implementing
rulenode2expr(hole::StateFixedShapedHole, grammar::Grammar)
should be straight forward:rulenode._val
rulenode.ind
, useget_rule(hole)
rulenode.children
, useget_children(hole)
The text was updated successfully, but these errors were encountered: