diff --git a/Project.toml b/Project.toml index fbb14d6..e707b63 100644 --- a/Project.toml +++ b/Project.toml @@ -1,10 +1,10 @@ name = "HerbCore" uuid = "2b23ba43-8213-43cb-b5ea-38c12b45bd45" authors = ["Jaap de Jong ", "Nicolae Filat ", "Tilman Hinnerichs ", "Sebastijan Dumancic "] -version = "0.1.1" +version = "0.2.0" [compat] -julia = "1.8" +julia = "^1.8" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/src/HerbCore.jl b/src/HerbCore.jl index c6be5a2..b2417df 100644 --- a/src/HerbCore.jl +++ b/src/HerbCore.jl @@ -20,6 +20,6 @@ export contains_hole, Constraint, - Grammar + AbstractGrammar end # module HerbCore diff --git a/src/grammar.jl b/src/grammar.jl index 027f2f6..97ec7ab 100644 --- a/src/grammar.jl +++ b/src/grammar.jl @@ -1,5 +1,5 @@ """ - Grammar + AbstractGrammar Abstract type representing all grammars. It is assumed that all grammar structs have at least the following attributes: @@ -16,6 +16,6 @@ If a rule is terminal, the corresponding list is empty. - `log_probabilities::Union{Vector{Real}, Nothing}`: A list of probabilities for each rule. If the grammar is non-probabilistic, the list can be `nothing`. -For concrete types, see [`ContextFreeGrammar`](@ref) and [`ContextSensitiveGrammar`](@ref). +For concrete types, see [`ContextSensitiveGrammar`](@ref) within the `HerbGrammar` module. """ -abstract type Grammar end \ No newline at end of file +abstract type AbstractGrammar end diff --git a/src/rulenode.jl b/src/rulenode.jl index 469b329..be09931 100644 --- a/src/rulenode.jl +++ b/src/rulenode.jl @@ -4,7 +4,7 @@ Abstract type for representing expression trees. Expression trees consist of [`RuleNode`](@ref)s and [`Hole`](@ref)s. -- A [`RuleNode`](@ref) represents a certain production rule in the [`Grammar`](@ref). +- A [`RuleNode`](@ref) represents a certain production rule in the [`AbstractGrammar`](@ref). - A [`Hole`](@ref) is a placeholder where certain rules in the grammar still can be applied. """ abstract type AbstractRuleNode end @@ -14,10 +14,10 @@ abstract type AbstractRuleNode end RuleNode <: AbstractRuleNode A [`RuleNode`](@ref) represents a node in an expression tree. -Each node corresponds to a certain rule in the [`Grammar`](@ref). +Each node corresponds to a certain rule in the [`AbstractGrammar`](@ref). A [`RuleNode`](@ref) consists of: -- `ind`: The index of the rule in the [`Grammar`](@ref) which this node is representing. +- `ind`: The index of the rule in the [`AbstractGrammar`](@ref) which this node is representing. - `_val`: Field for storing immediately evaluated values - `children`: The children of this node in the expression tree @@ -58,7 +58,7 @@ RuleNode(ind::Int) = RuleNode(ind, nothing, AbstractRuleNode[]) """ RuleNode(ind::Int, children::Vector{AbstractRuleNode}) -Create a [`RuleNode`](@ref) for the [`Grammar`](@ref) rule with index `ind` and `children` as subtrees. +Create a [`RuleNode`](@ref) for the [`AbstractGrammar`](@ref) rule with index `ind` and `children` as subtrees. """ RuleNode(ind::Int, children::Vector{AbstractRuleNode}) = RuleNode(ind, nothing, children) RuleNode(ind::Int, children::Vector{RuleNode}) = RuleNode(ind, nothing, children) @@ -68,12 +68,12 @@ RuleNode(ind::Int, children::Vector{Hole}) = RuleNode(ind, nothing, children) """ RuleNode(ind::Int, _val::Any) -Create a [`RuleNode`](@ref) for the [`Grammar`](@ref) rule with index `ind`, +Create a [`RuleNode`](@ref) for the [`AbstractGrammar`](@ref) rule with index `ind`, `_val` as immediately evaluated value and no children !!! warning Only use this constructor if you are absolutely certain that a rule is terminal and cannot have children. - Use [`RuleNode(ind::Int, grammar::Grammar)`] for rules that might have children. + Use [`RuleNode(ind::Int, grammar::AbstractGrammar)`] for rules that might have children. In general, [`Hole`](@ref)s should be used as a placeholder when the children of a node are not yet known. !!! compat