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.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
-
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.Every native call obtains the pointers of the objects it uses through this method, so that using an object after its native resource has been released raises an exception instead of crashing the JVM.
- Returns:
- the pointer value
- Throws:
IllegalStateException- if the native resource of this object has been released, e.g., viadeletePointer()
-
deletePointer
public void deletePointer()Free the native resource associated with this pointer.Native resources are freed automatically once the Java object is no longer reachable. This method frees the native resource immediately instead; afterwards, using the object raises an
IllegalStateException. It must be called from the thread that is using the associated term manager. Calling it more than once has no further effect. -
toString
Return a string representation of the pointer.
-