HerbInterpret.jl Documentation
HerbInterpret.evaluate_program
— Methodevaluate_program(program::RuleNode, examples::Vector{<:IOExample}, grammar::AbstractGrammar, evaluation_function::Function)
Runs a program on the examples and returns tuples of actual desired output and the program's output
HerbInterpret.execute_on_input
— Methodexecute_on_input(grammar::AbstractGrammar, program::RuleNode, input::Dict{Symbol, T})::Any where T
Converts a RuleNode
program into an expression using a given grammar
, then evaluates this expression with a single input dictionary input
and a symbol table derived from the grammar
using execute_on_input(tab::SymbolTable, expr::Any, input::Dict{Symbol, T})
.
Arguments
grammar::AbstractGrammar
: A grammar object used to convert theRuleNode
into an executable expression.program::RuleNode
: The program, represented as aRuleNode
, to be converted and evaluated.input::Dict{Symbol, T}
: A dictionary providing input values for symbols used in the generated expression.
Returns
Any
: The result of evaluating the generated expression with the given input dictionary.
HerbInterpret.execute_on_input
— Methodexecute_on_input(grammar::AbstractGrammar, program::RuleNode, input::Vector{T})::Vector{Any} where T <: Dict{Symbol, <:Any}
Converts a RuleNode
program into an expression using a given grammar
, then evaluates this expression for each input dictionary in a vector input
and a symbol table derived from the grammar
using execute_on_input(tab::SymbolTable, expr::Any, input::Dict{Symbol, T})
.
Arguments
grammar::AbstractGrammar
: A grammar object used to convert theRuleNode
into an executable expression.program::RuleNode
: The program, represented as aRuleNode
, to be converted and evaluated.input::Vector{T}
: A vector of dictionaries, each providing input values for symbols used in the generated expression.
Returns
Vector{Any}
: A vector containing the results of evaluating the generated expression for each input dictionary.
HerbInterpret.execute_on_input
— Methodexecute_on_input(tab::SymbolTable, expr::Any, input::Dict{Symbol, T})::Any where T
Evaluates an expression expr
within the context of a symbol table tab
and a single input dictionary input
. The input dictionary keys should match the symbols used in the expression, and their values are used during the expression's evaluation.
Arguments
tab::SymbolTable
: A symbol table containing predefined symbols and their associated values or functions.expr::Any
: The expression to be evaluated. Can be any Julia expression that is valid within the context of the provided symbol table and input.input::Dict{Symbol, T}
: A dictionary where each key is a symbol used in the expression, and the value is the corresponding value to be used in the expression's evaluation. The typeT
can be any type.
Returns
Any
: The result of evaluating the expression with the given symbol table and input dictionary.
This function throws exceptions that are caused in the given expression. These exceptions have to be handled by the caller of this function.
HerbInterpret.execute_on_input
— Methodexecute_on_input(tab::SymbolTable, expr::Any, input::Vector{T})::Vector{<:Any} where T <: Dict{Symbol, <:Any}
Wrapper around execute_on_input
to execute all inputs given as an array.
Arguments
tab::SymbolTable
: A symbol table containing predefined symbols and their associated values or functions.expr::Any
: The expression to be evaluated for each input dictionary.inputs::Vector{T}
: A vector of dictionaries, each serving as an individual set of inputs for the expression's evaluation.
Returns
Vector{<:Any}
: A vector containing the results of evaluating the expression for each input dictionary.
HerbInterpret.interpret
— Methodinterpret(tab::SymbolTable, ex::Expr)
Evaluates an expression without compiling it. Uses AST and symbol lookups. Only supports :call and :(=) expressions at the moment.
Example usage:
tab = SymbolTable(:f => f, :x => x)
ex = :(f(x))
interpret(tab, ex)
WARNING: This function throws exceptions that are caused in the given expression. These exceptions have to be handled by the caller of this function.
HerbInterpret.test_all_examples
— Methodtest_all_examples(tab::SymbolTable, expr::Any, examples::Vector{IOExample})::Vector{Bool}
This function is deprecated. Please use execute_on_input
instead.
Runs the interpreter on all examples with the given input table and expression. The symbol table defines everything (functions, symbols) that are not input variables to the program to be synthesised. Returns a list of true/false values indicating if the expression satisfies the corresponding example. WARNING: This function throws exceptions that are caused in the given expression. These exceptions have to be handled by the caller of this function.
HerbInterpret.test_examples
— Methodtest_examples(tab::SymbolTable, expr::Any, examples::Vector{IOExample})::Bool
This function is deprecated. Please use execute_on_input
instead.
Evaluates all examples and returns true iff all examples pass. Shortcircuits as soon as an example is found for which the program doesn't work. Returns false if one of the examples produces an error.
Index
HerbConstraints.AbstractGrammarConstraint
HerbConstraints.AbstractLocalConstraint
HerbConstraints.AbstractStateManager
HerbConstraints.Contains
HerbConstraints.ContainsSubtree
HerbConstraints.DomainRuleNode
HerbConstraints.Forbidden
HerbConstraints.ForbiddenSequence
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.GenericSolver
HerbConstraints.LessThanOrEqualHardFail
HerbConstraints.LessThanOrEqualResult
HerbConstraints.LessThanOrEqualSoftFail
HerbConstraints.LessThanOrEqualSuccess
HerbConstraints.LessThanOrEqualSuccessEquality
HerbConstraints.LessThanOrEqualSuccessLessThan
HerbConstraints.LessThanOrEqualSuccessWithHoles
HerbConstraints.LocalContains
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalContainsSubtree
HerbConstraints.LocalForbidden
HerbConstraints.LocalForbiddenSequence
HerbConstraints.LocalOrdered
HerbConstraints.LocalUnique
HerbConstraints.MakeEqualHardFail
HerbConstraints.MakeEqualResult
HerbConstraints.MakeEqualSoftFail
HerbConstraints.MakeEqualSuccess
HerbConstraints.Ordered
HerbConstraints.PatternMatchHardFail
HerbConstraints.PatternMatchResult
HerbConstraints.PatternMatchSoftFail
HerbConstraints.PatternMatchSuccess
HerbConstraints.PatternMatchSuccessWhenHoleAssignedTo
HerbConstraints.Solver
HerbConstraints.SolverState
HerbConstraints.SolverStatistics
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateHole
HerbConstraints.StateInt
HerbConstraints.StateIntBackup
HerbConstraints.StateManager
HerbConstraints.StateSparseSet
HerbConstraints.StateSparseSet
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.StateStack
HerbConstraints.UniformSolver
HerbConstraints.UniformSolver
HerbConstraints.Unique
HerbConstraints.VarNode
HerbCore.AbstractConstraint
HerbCore.AbstractGrammar
HerbCore.AbstractHole
HerbCore.AbstractRuleNode
HerbCore.AbstractUniformHole
HerbCore.Hole
HerbCore.HoleReference
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.RuleNode
HerbCore.UniformHole
HerbGrammar.ContextSensitiveGrammar
HerbGrammar.NodeLoc
HerbGrammar.SymbolTable
HerbSearch.AbstractBFSIterator
HerbSearch.AbstractDFSIterator
HerbSearch.AbstractMHSearchIterator
HerbSearch.AbstractSASearchIterator
HerbSearch.AbstractVLSNSearchIterator
HerbSearch.BFSIterator
HerbSearch.DFSIterator
HerbSearch.ExpandFailureReason
HerbSearch.GeneticSearchIterator
HerbSearch.MHSearchIterator
HerbSearch.MLFSIterator
HerbSearch.ProgramIterator
HerbSearch.RandomIterator
HerbSearch.SASearchIterator
HerbSearch.StochasticSearchIterator
HerbSearch.SynthResult
HerbSearch.TopDownIterator
HerbSearch.UniformIterator
HerbSearch.UniformIterator
HerbSearch.VLSNSearchIterator
HerbSpecification.AbstractDependentTypeSpecification
HerbSpecification.AgdaSpecification
HerbSpecification.IOExample
HerbSpecification.MetricProblem
HerbSpecification.Problem
HerbSpecification.SMTSpecification
HerbSpecification.Trace
Base.collect
Base.collect
Base.findall
Base.findfirst
Base.findlast
Base.get
Base.getindex
Base.getindex
Base.in
Base.in
Base.insert!
Base.isless
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.iterate
Base.length
Base.length
Base.length
Base.length
Base.push!
Base.rand
Base.rand
Base.rand
Base.show
Base.size
Base.size
Base.sum
HerbConstraints._contains
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences
HerbConstraints._count_occurrences!
HerbConstraints._exchange_positions!
HerbConstraints._update_bounds_val_removed!
HerbConstraints._update_max_val_removed!
HerbConstraints._update_min_val_removed!
HerbConstraints.annotation2constraint
HerbConstraints.are_disjoint
HerbConstraints.are_disjoint
HerbConstraints.backup!
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.check_tree
HerbConstraints.contains_varnode
HerbConstraints.deactivate!
HerbConstraints.deactivate!
HerbConstraints.decrement!
HerbConstraints.fix_point!
HerbConstraints.freeze_state
HerbConstraints.get_grammar
HerbConstraints.get_grammar
HerbConstraints.get_hole_at_location
HerbConstraints.get_hole_at_location
HerbConstraints.get_intersection
HerbConstraints.get_max_depth
HerbConstraints.get_max_size
HerbConstraints.get_nodes
HerbConstraints.get_nodes_on_path
HerbConstraints.get_priority
HerbConstraints.get_starting_symbol
HerbConstraints.get_state
HerbConstraints.get_tree
HerbConstraints.get_tree
HerbConstraints.get_tree_size
HerbConstraints.get_value
HerbConstraints.increment!
HerbConstraints.is_subdomain
HerbConstraints.is_subdomain
HerbConstraints.isfeasible
HerbConstraints.isfeasible
HerbConstraints.load_state!
HerbConstraints.make_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.make_less_than_or_equal!
HerbConstraints.new_state!
HerbConstraints.notify_new_node
HerbConstraints.notify_new_nodes
HerbConstraints.notify_new_nodes
HerbConstraints.notify_tree_manipulation
HerbConstraints.notify_tree_manipulation
HerbConstraints.partition
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.pattern_match
HerbConstraints.post!
HerbConstraints.post!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.propagate!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_above!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_all_but!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_below!
HerbConstraints.remove_node!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.restore!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.save_state!
HerbConstraints.schedule!
HerbConstraints.set_infeasible!
HerbConstraints.set_infeasible!
HerbConstraints.set_value!
HerbConstraints.shouldschedule
HerbConstraints.shouldschedule
HerbConstraints.simplify_hole!
HerbConstraints.substitute!
HerbCore.contains_hole
HerbCore.contains_hole
HerbCore.contains_index
HerbCore.contains_nonuniform_hole
HerbCore.depth
HerbCore.get_children
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_node_at_location
HerbCore.get_path
HerbCore.get_path
HerbCore.get_path
HerbCore.get_rule
HerbCore.get_rule
HerbCore.get_rulesequence
HerbCore.hasdynamicvalue
HerbCore.have_same_shape
HerbCore.isfilled
HerbCore.isfilled
HerbCore.isuniform
HerbCore.node_depth
HerbCore.number_of_holes
HerbCore.rulesoftype
HerbCore.rulesoftype
HerbCore.rulesonleft
HerbCore.swap_node
HerbCore.swap_node
HerbGrammar.add_rule!
HerbGrammar.add_rule!
HerbGrammar.add_rule!
HerbGrammar.addconstraint!
HerbGrammar.child_types
HerbGrammar.child_types
HerbGrammar.cleanup_removed_rules!
HerbGrammar.clearconstraints!
HerbGrammar.containedin
HerbGrammar.contains_returntype
HerbGrammar.expr2csgrammar
HerbGrammar.expr2pcsgrammar
HerbGrammar.expr2rulenode
HerbGrammar.expr2rulenode
HerbGrammar.expr2rulenode
HerbGrammar.expr2rulenode
HerbGrammar.get_childtypes
HerbGrammar.get_domain
HerbGrammar.get_domain
HerbGrammar.get_rulesequence
HerbGrammar.grammar2symboltable
HerbGrammar.init_probabilities!
HerbGrammar.iscomplete
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.iseval
HerbGrammar.isprobabilistic
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isterminal
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.isvariable
HerbGrammar.log_probability
HerbGrammar.max_arity
HerbGrammar.max_rulenode_log_probability
HerbGrammar.merge_grammars!
HerbGrammar.mindepth
HerbGrammar.mindepth_map
HerbGrammar.nchildren
HerbGrammar.nchildren
HerbGrammar.nonterminals
HerbGrammar.normalize!
HerbGrammar.parse_probabilistic_rule
HerbGrammar.probability
HerbGrammar.read_csg
HerbGrammar.read_pcsg
HerbGrammar.remove_rule!
HerbGrammar.return_type
HerbGrammar.return_type
HerbGrammar.return_type
HerbGrammar.root_node_loc
HerbGrammar.rulenode2expr
HerbGrammar.rulenode_log_probability
HerbGrammar.rulesonleft
HerbGrammar.store_csg
HerbGrammar.subsequenceof
HerbGrammar.swap_node
HerbGrammar.swap_node
HerbInterpret.evaluate_program
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.execute_on_input
HerbInterpret.interpret
HerbInterpret.test_all_examples
HerbInterpret.test_examples
HerbSearch._calculate_cost
HerbSearch._find_next_complete_tree
HerbSearch.accept
HerbSearch.best_accept
HerbSearch.calculate_cost
HerbSearch.const_temperature
HerbSearch.constructNeighbourhood
HerbSearch.constructNeighbourhoodRuleSubset
HerbSearch.cross_over
HerbSearch.crossover_swap_children_1
HerbSearch.crossover_swap_children_2
HerbSearch.decreasing_temperature
HerbSearch.default_fitness
HerbSearch.derivation_heuristic
HerbSearch.derivation_heuristic
HerbSearch.derivation_heuristic
HerbSearch.enumerate_neighbours_propose
HerbSearch.evaluate
HerbSearch.extract_name_from_argument
HerbSearch.fitness
HerbSearch.generate_branches
HerbSearch.get_best_program
HerbSearch.heuristic_leftmost
HerbSearch.heuristic_random
HerbSearch.heuristic_rightmost
HerbSearch.heuristic_smallest_domain
HerbSearch.hole_heuristic
HerbSearch.is_field_decl
HerbSearch.is_kwdef
HerbSearch.mean_squared_error
HerbSearch.misclassification
HerbSearch.mutate!
HerbSearch.mutate_random!
HerbSearch.neighbourhood
HerbSearch.next_solution!
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.priority_function
HerbSearch.probabilistic_accept
HerbSearch.probabilistic_accept_with_temperature
HerbSearch.probabilistic_accept_with_temperature_fraction
HerbSearch.processkwarg!
HerbSearch.propose
HerbSearch.random_fill_propose
HerbSearch.select_chromosome
HerbSearch.select_fitness_proportional_parents
HerbSearch.select_parents
HerbSearch.set_stateholes!
HerbSearch.synth
HerbSearch.temperature
HerbSearch.validate_iterator
StatsBase.sample
StatsBase.sample
StatsBase.sample
StatsBase.sample
HerbConstraints.@csgrammar_annotated
HerbCore.@rulenode
HerbGrammar.@cfgrammar
HerbGrammar.@csgrammar
HerbGrammar.@pcsgrammar
HerbSearch.@programiterator