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 TConverts 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 theRuleNodeinto 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 theRuleNodeinto 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 TEvaluates 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 typeTcan be any type.
Returns
Any: The result of evaluating the expression with the given symbol table and input dictionary.
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.
Index
HerbConstraints.AbstractGrammarConstraintHerbConstraints.AbstractLocalConstraintHerbConstraints.AbstractStateManagerHerbConstraints.ContainsHerbConstraints.ContainsSubtreeHerbConstraints.DomainRuleNodeHerbConstraints.ForbiddenHerbConstraints.ForbiddenSequenceHerbConstraints.GenericSolverHerbConstraints.GenericSolverHerbConstraints.GenericSolverHerbConstraints.LessThanOrEqualHardFailHerbConstraints.LessThanOrEqualResultHerbConstraints.LessThanOrEqualSoftFailHerbConstraints.LessThanOrEqualSuccessHerbConstraints.LessThanOrEqualSuccessEqualityHerbConstraints.LessThanOrEqualSuccessLessThanHerbConstraints.LessThanOrEqualSuccessWithHolesHerbConstraints.LocalContainsHerbConstraints.LocalContainsSubtreeHerbConstraints.LocalContainsSubtreeHerbConstraints.LocalForbiddenHerbConstraints.LocalForbiddenSequenceHerbConstraints.LocalOrderedHerbConstraints.LocalUniqueHerbConstraints.MakeEqualHardFailHerbConstraints.MakeEqualResultHerbConstraints.MakeEqualSoftFailHerbConstraints.MakeEqualSuccessHerbConstraints.OrderedHerbConstraints.PatternMatchHardFailHerbConstraints.PatternMatchResultHerbConstraints.PatternMatchSoftFailHerbConstraints.PatternMatchSuccessHerbConstraints.PatternMatchSuccessWhenHoleAssignedToHerbConstraints.SolverHerbConstraints.SolverStateHerbConstraints.StateHoleHerbConstraints.StateHoleHerbConstraints.StateHoleHerbConstraints.StateIntHerbConstraints.StateIntBackupHerbConstraints.StateManagerHerbConstraints.StateSparseSetHerbConstraints.StateSparseSetHerbConstraints.StateStackHerbConstraints.StateStackHerbConstraints.StateStackHerbConstraints.UniformSolverHerbConstraints.UniformSolverHerbConstraints.UniqueHerbConstraints.VarNodeHerbCore.AbstractConstraintHerbCore.AbstractGrammarHerbCore.AbstractHoleHerbCore.AbstractRuleNodeHerbCore.AbstractUniformHoleHerbCore.HoleHerbCore.HoleReferenceHerbCore.RuleNodeHerbCore.RuleNodeHerbCore.RuleNodeHerbCore.UniformHoleHerbGrammar.ContextSensitiveGrammarHerbGrammar.NodeLocHerbGrammar.SymbolTableHerbSearch.AbstractBFSIteratorHerbSearch.AbstractDFSIteratorHerbSearch.AbstractMHSearchIteratorHerbSearch.AbstractSASearchIteratorHerbSearch.AbstractVLSNSearchIteratorHerbSearch.BFSIteratorHerbSearch.DFSIteratorHerbSearch.ExpandFailureReasonHerbSearch.GeneticSearchIteratorHerbSearch.MHSearchIteratorHerbSearch.MLFSIteratorHerbSearch.ProgramIteratorHerbSearch.RandomIteratorHerbSearch.SASearchIteratorHerbSearch.StochasticSearchIteratorHerbSearch.SynthResultHerbSearch.TopDownIteratorHerbSearch.UniformIteratorHerbSearch.UniformIteratorHerbSearch.VLSNSearchIteratorHerbSpecification.AbstractDependentTypeSpecificationHerbSpecification.AgdaSpecificationHerbSpecification.IOExampleHerbSpecification.MetricProblemHerbSpecification.ProblemHerbSpecification.SMTSpecificationHerbSpecification.TraceBase.collectBase.collectBase.findallBase.findfirstBase.findlastBase.getBase.getindexBase.getindexBase.inBase.inBase.insert!Base.islessBase.iterateBase.iterateBase.iterateBase.iterateBase.iterateBase.lengthBase.lengthBase.lengthBase.lengthBase.push!Base.randBase.randBase.randBase.showBase.sizeBase.sizeBase.sumHerbConstraints._containsHerbConstraints._count_occurrencesHerbConstraints._count_occurrencesHerbConstraints._count_occurrences!HerbConstraints._exchange_positions!HerbConstraints._update_bounds_val_removed!HerbConstraints._update_max_val_removed!HerbConstraints._update_min_val_removed!HerbConstraints.annotation2constraintHerbConstraints.are_disjointHerbConstraints.are_disjointHerbConstraints.backup!HerbConstraints.check_treeHerbConstraints.check_treeHerbConstraints.check_treeHerbConstraints.check_treeHerbConstraints.check_treeHerbConstraints.check_treeHerbConstraints.contains_varnodeHerbConstraints.deactivate!HerbConstraints.deactivate!HerbConstraints.decrement!HerbConstraints.fix_point!HerbConstraints.freeze_stateHerbConstraints.get_grammarHerbConstraints.get_grammarHerbConstraints.get_hole_at_locationHerbConstraints.get_hole_at_locationHerbConstraints.get_intersectionHerbConstraints.get_max_depthHerbConstraints.get_max_sizeHerbConstraints.get_nodesHerbConstraints.get_nodes_on_pathHerbConstraints.get_priorityHerbConstraints.get_starting_symbolHerbConstraints.get_stateHerbConstraints.get_treeHerbConstraints.get_treeHerbConstraints.get_tree_sizeHerbConstraints.get_valueHerbConstraints.increment!HerbConstraints.is_subdomainHerbConstraints.is_subdomainHerbConstraints.isfeasibleHerbConstraints.isfeasibleHerbConstraints.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_nodeHerbConstraints.notify_new_nodesHerbConstraints.notify_new_nodesHerbConstraints.notify_tree_manipulationHerbConstraints.notify_tree_manipulationHerbConstraints.partitionHerbConstraints.pattern_matchHerbConstraints.pattern_matchHerbConstraints.pattern_matchHerbConstraints.pattern_matchHerbConstraints.pattern_matchHerbConstraints.pattern_matchHerbConstraints.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_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.shouldscheduleHerbConstraints.shouldscheduleHerbConstraints.simplify_hole!HerbConstraints.substitute!HerbCore.contains_holeHerbCore.contains_holeHerbCore.contains_indexHerbCore.contains_nonuniform_holeHerbCore.depthHerbCore.get_childrenHerbCore.get_node_at_locationHerbCore.get_node_at_locationHerbCore.get_node_at_locationHerbCore.get_node_at_locationHerbCore.get_pathHerbCore.get_pathHerbCore.get_pathHerbCore.get_ruleHerbCore.get_ruleHerbCore.get_rulesequenceHerbCore.hasdynamicvalueHerbCore.have_same_shapeHerbCore.is_domain_validHerbCore.isfilledHerbCore.isfilledHerbCore.issameHerbCore.isuniformHerbCore.node_depthHerbCore.number_of_holesHerbCore.rulesoftypeHerbCore.rulesoftypeHerbCore.rulesonleftHerbCore.swap_nodeHerbCore.swap_nodeHerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbCore.update_rule_indices!HerbGrammar.add_rule!HerbGrammar.add_rule!HerbGrammar.add_rule!HerbGrammar.addconstraint!HerbGrammar.child_typesHerbGrammar.child_typesHerbGrammar.cleanup_removed_rules!HerbGrammar.clearconstraints!HerbGrammar.containedinHerbGrammar.contains_returntypeHerbGrammar.expr2csgrammarHerbGrammar.expr2pcsgrammarHerbGrammar.expr2rulenodeHerbGrammar.expr2rulenodeHerbGrammar.expr2rulenodeHerbGrammar.expr2rulenodeHerbGrammar.get_childtypesHerbGrammar.get_domainHerbGrammar.get_domainHerbGrammar.get_rulesequenceHerbGrammar.grammar2symboltableHerbGrammar.init_probabilities!HerbGrammar.iscompleteHerbGrammar.isevalHerbGrammar.isevalHerbGrammar.isevalHerbGrammar.isprobabilisticHerbGrammar.isterminalHerbGrammar.isterminalHerbGrammar.isterminalHerbGrammar.isvariableHerbGrammar.isvariableHerbGrammar.isvariableHerbGrammar.isvariableHerbGrammar.log_probabilityHerbGrammar.max_arityHerbGrammar.max_rulenode_log_probabilityHerbGrammar.merge_grammars!HerbGrammar.mindepthHerbGrammar.mindepth_mapHerbGrammar.nchildrenHerbGrammar.nchildrenHerbGrammar.nonterminalsHerbGrammar.normalize!HerbGrammar.parse_probabilistic_ruleHerbGrammar.probabilityHerbGrammar.read_csgHerbGrammar.read_pcsgHerbGrammar.remove_rule!HerbGrammar.return_typeHerbGrammar.return_typeHerbGrammar.return_typeHerbGrammar.root_node_locHerbGrammar.rulenode2exprHerbGrammar.rulenode_log_probabilityHerbGrammar.rulesonleftHerbGrammar.store_csgHerbGrammar.subsequenceofHerbGrammar.swap_nodeHerbGrammar.swap_nodeHerbInterpret.evaluate_programHerbInterpret.execute_on_inputHerbInterpret.execute_on_inputHerbInterpret.execute_on_inputHerbInterpret.execute_on_inputHerbInterpret.interpretHerbSearch._calculate_costHerbSearch._find_next_complete_treeHerbSearch.acceptHerbSearch.best_acceptHerbSearch.calculate_costHerbSearch.const_temperatureHerbSearch.constructNeighbourhoodHerbSearch.constructNeighbourhoodRuleSubsetHerbSearch.cross_overHerbSearch.crossover_swap_children_1HerbSearch.crossover_swap_children_2HerbSearch.decreasing_temperatureHerbSearch.default_fitnessHerbSearch.derivation_heuristicHerbSearch.derivation_heuristicHerbSearch.derivation_heuristicHerbSearch.enumerate_neighbours_proposeHerbSearch.evaluateHerbSearch.extract_name_from_argumentHerbSearch.fitnessHerbSearch.generate_branchesHerbSearch.get_best_programHerbSearch.heuristic_leftmostHerbSearch.heuristic_randomHerbSearch.heuristic_rightmostHerbSearch.heuristic_smallest_domainHerbSearch.hole_heuristicHerbSearch.is_field_declHerbSearch.is_kwdefHerbSearch.mean_squared_errorHerbSearch.misclassificationHerbSearch.mutate!HerbSearch.mutate_random!HerbSearch.neighbourhoodHerbSearch.next_solution!HerbSearch.priority_functionHerbSearch.priority_functionHerbSearch.priority_functionHerbSearch.priority_functionHerbSearch.probabilistic_acceptHerbSearch.probabilistic_accept_with_temperatureHerbSearch.probabilistic_accept_with_temperature_fractionHerbSearch.processkwarg!HerbSearch.proposeHerbSearch.random_fill_proposeHerbSearch.select_chromosomeHerbSearch.select_fitness_proportional_parentsHerbSearch.select_parentsHerbSearch.set_stateholes!HerbSearch.synthHerbSearch.temperatureHerbSearch.validate_iteratorStatsBase.sampleStatsBase.sampleStatsBase.sampleStatsBase.sampleHerbConstraints.@csgrammar_annotatedHerbCore.@rulenodeHerbGrammar.@cfgrammarHerbGrammar.@csgrammarHerbGrammar.@pcsgrammarHerbSearch.@programiterator