Package io.github.cvc5
Class Grammar
java.lang.Object
io.github.cvc5.Grammar
A Sygus Grammar.
This class can be used to define a context-free grammar of terms. Its
interface coincides with the definition of grammars (
GrammarDef
) in
the SyGuS IF 2.1 standard.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnyConstant
(Term ntSymbol) AllowntSymbol
to be an arbitrary constant.void
addAnyVariable
(Term ntSymbol) AllowntSymbol
to be any input variable to correspondingsynth-fun
orsynth-inv
with the same sort asntSymbol
.void
Addrule
to the set of rules corresponding tontSymbol
.void
Addrules
to the set of rules corresponding tontSymbol
.void
Free the native resource associated with this pointer.protected void
deletePointer
(long pointer) Delete the native resource associated with the specified pointer.boolean
Referential equality operator.long
Return the raw native pointer.int
hashCode()
Get the hash value of a grammar.boolean
isNull()
Determine if this is the null grammar.toString()
Return a string representation of the pointer.protected String
toString
(long pointer) Return a string representation of the specified native pointer.
-
Field Details
-
pointer
protected long pointerThe raw native pointer value.
-
-
Constructor Details
-
Grammar
Constructs a newGrammar
instance by creating a deep copy of the specifiedGrammar
.- Parameters:
grammar
- TheGrammar
instance to copy.
-
-
Method Details
-
deletePointer
protected void deletePointer(long pointer) Delete the native resource associated with the specified pointer.Subclasses must implement this method to provide resource-specific cleanup logic.
- Parameters:
pointer
- the native pointer to delete
-
isNull
public boolean isNull()Determine if this is the null grammar.- Returns:
- True if this Grammar is the null grammar.
-
equals
Referential equality operator. -
addRule
Addrule
to the set of rules corresponding tontSymbol
.- Parameters:
ntSymbol
- the non-terminal to which the rule is added.rule
- the rule to add.
-
addRules
Addrules
to the set of rules corresponding tontSymbol
.- Parameters:
ntSymbol
- the non-terminal to which the rules are added.rules
- the rules to add.
-
addAnyConstant
AllowntSymbol
to be an arbitrary constant.- Parameters:
ntSymbol
- the non-terminal allowed to be any constant.
-
addAnyVariable
AllowntSymbol
to be any input variable to correspondingsynth-fun
orsynth-inv
with the same sort asntSymbol
.- Parameters:
ntSymbol
- the non-terminal allowed to be any input constant.
-
toString
Return a string representation of the specified native pointer.Subclasses must implement this method to convert the native pointer into a meaningful string.
- Parameters:
pointer
- the native pointer- Returns:
- A String representation of this grammar.
-
hashCode
public int hashCode()Get the hash value of a grammar. -
getPointer
public long getPointer()Return the raw native pointer.- Returns:
- the pointer value
-
deletePointer
public void deletePointer()Free the native resource associated with this pointer.This method should be called to explicitly clean up the underlying native resource. It removes this instance from the
Context
, then invokes the subclass-defineddeletePointer(long)
method to perform the actual cleanup. -
toString
Return a string representation of the pointer.
-