Herb-AI / HerbSearch.jl

Search procedures and synthesizers for Herb.jl
https://herb-ai.github.io/
MIT License
5 stars 0 forks source link

Program iterator refactor #84

Closed nicolaefilat closed 6 months ago

nicolaefilat commented 6 months ago

@programiterator changes

There are now 3 constructors for the iterator that all use the solver. This should close #67

function iter(grammar, start_symbol, customargs..., max_depth = maxInt, max_size = maxInt, kwargs...)
    return (GenericSolver(grammar,start_symbol), customargs..., max_depth = max_depth, max_size = max_size,  kwargs...)
end
function iter(grammar, start_node, customargs..., max_depth = maxInt, max_size = maxInt, kwargs...)
    return (GenericSolver(grammar, start_node), customargs..., max_depth = max_depth, max_size = max_size,  kwargs....)
end
function iter(solver, customargs..., kwargs...)
    return (solver, customargs...,  ,  kwargs...)
end

Because users might by mistake add solver as a field to the function I have a check that disallows some reserved name which are solver, grammar, max_size etc

Comments

The merge requests is quite big 😉because a lot of changes had to be done in all the places where iterators were created. Hopefully from now one we are not going to change the macro again.

Nice todo would be to add tests that the @programiterator fails when users add grammar as their own field

Update: The PR is merged (This PR depends on another PR (See PR) from HerbConstraints that adds the get_starting symbol function)

Documentation

I just noticed that the stochastic functions have outdated documentation and I added a TODO there. I could have fixed that in this PR but that would have been too many changes I think

I had to remove some of the @sourceCode4's tests because they were too complex 😄

ReubenJ commented 6 months ago

@nicolaefilat I've merged @Whebon's PRs now, and this introduced some conflicts. Could you update this branch/PR to resolve them? I'll review once it's up-to-date 👍