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 TypeMethodDescriptionvoidaddAnyConstant(Term ntSymbol) AllowntSymbolto be an arbitrary constant.voidaddAnyVariable(Term ntSymbol) AllowntSymbolto be any input variable to correspondingsynth-funorsynth-invwith the same sort asntSymbol.voidAddruleto the set of rules corresponding tontSymbol.voidAddrulesto the set of rules corresponding tontSymbol.voidFree the native resource associated with this pointer.protected voiddeletePointer(long pointer) Delete the native resource associated with the specified pointer.booleanReferential equality operator.longReturn the raw native pointer.inthashCode()Get the hash value of a grammar.booleanisNull()Determine if this is the null grammar.toString()Return a string representation of the pointer.protected StringtoString(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 newGrammarinstance by creating a deep copy of the specifiedGrammar.- Parameters:
 grammar- TheGrammarinstance 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
Addruleto the set of rules corresponding tontSymbol.- Parameters:
 ntSymbol- the non-terminal to which the rule is added.rule- the rule to add.
 - 
addRules
Addrulesto the set of rules corresponding tontSymbol.- Parameters:
 ntSymbol- the non-terminal to which the rules are added.rules- the rules to add.
 - 
addAnyConstant
AllowntSymbolto be an arbitrary constant.- Parameters:
 ntSymbol- the non-terminal allowed to be any constant.
 - 
addAnyVariable
AllowntSymbolto be any input variable to correspondingsynth-funorsynth-invwith 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. 
 -