Clingo
Loading...
Searching...
No Matches
Abstract Syntax Trees

Functions and data structures to work with program ASTs. More...

Typedefs

typedef int clingo_ast_type_t
 Corresponding type to clingo_ast_type_e.
 
typedef int clingo_ast_attribute_t
 Corresponding type to clingo_ast_attribute_e.
 
typedef struct clingo_ast clingo_ast_t
 This struct provides a view to nodes in the AST.
 
typedef int clingo_projection_mode_t
 Corresponding type to clingo_projection_mode_e.
 
typedef struct clingo_ast_rewrite_context clingo_ast_rewrite_context_t
 Context object to rewrite statements.
 
typedef struct clingo_program clingo_program_t
 Object to store.
 

Enumerations

enum  clingo_ast_type_e {
  clingo_ast_type_projection , clingo_ast_type_term_variable , clingo_ast_type_term_symbolic , clingo_ast_type_term_absolute ,
  clingo_ast_type_term_unary_operation , clingo_ast_type_term_binary_operation , clingo_ast_type_term_tuple , clingo_ast_type_term_function ,
  clingo_ast_type_argument_tuple , clingo_ast_type_unparsed_element , clingo_ast_type_theory_term_variable , clingo_ast_type_theory_term_symbolic ,
  clingo_ast_type_theory_term_tuple , clingo_ast_type_theory_term_function , clingo_ast_type_theory_term_unparsed , clingo_ast_type_left_guard ,
  clingo_ast_type_right_guard , clingo_ast_type_literal_boolean , clingo_ast_type_literal_comparison , clingo_ast_type_literal_symbolic ,
  clingo_ast_type_set_aggregate_element , clingo_ast_type_theory_atom_element , clingo_ast_type_theory_right_guard , clingo_ast_type_body_simple_literal ,
  clingo_ast_type_body_aggregate_element , clingo_ast_type_body_aggregate , clingo_ast_type_body_set_aggregate , clingo_ast_type_body_theory_atom ,
  clingo_ast_type_body_conditional_literal , clingo_ast_type_head_simple_literal , clingo_ast_type_head_aggregate_element , clingo_ast_type_head_aggregate ,
  clingo_ast_type_head_set_aggregate , clingo_ast_type_head_theory_atom , clingo_ast_type_head_conditional_literal , clingo_ast_type_head_disjunction ,
  clingo_ast_type_theory_operator_definition , clingo_ast_type_theory_term_definition , clingo_ast_type_theory_guard_definition , clingo_ast_type_theory_atom_definition ,
  clingo_ast_type_optimize_tuple , clingo_ast_type_optimize_element , clingo_ast_type_edge , clingo_ast_type_program_part ,
  clingo_ast_type_statement_rule , clingo_ast_type_statement_theory , clingo_ast_type_statement_optimize , clingo_ast_type_statement_weak_constraint ,
  clingo_ast_type_statement_show , clingo_ast_type_statement_show_nothing , clingo_ast_type_statement_show_signature , clingo_ast_type_statement_project ,
  clingo_ast_type_statement_project_signature , clingo_ast_type_statement_defined , clingo_ast_type_statement_external , clingo_ast_type_statement_edge ,
  clingo_ast_type_statement_heuristic , clingo_ast_type_statement_script , clingo_ast_type_statement_program , clingo_ast_type_statement_include ,
  clingo_ast_type_statement_const , clingo_ast_type_statement_parts , clingo_ast_type_statement_comment
}
 Enumeration of AST types.
 
enum  clingo_ast_attribute_e {
  clingo_ast_attribute_anonymous , clingo_ast_attribute_arguments , clingo_ast_attribute_arity , clingo_ast_attribute_atom ,
  clingo_ast_attribute_atoms , clingo_ast_attribute_atom_type , clingo_ast_attribute_body , clingo_ast_attribute_comment_type ,
  clingo_ast_attribute_condition , clingo_ast_attribute_precedence , clingo_ast_attribute_elements , clingo_ast_attribute_external ,
  clingo_ast_attribute_external_type , clingo_ast_attribute_function , clingo_ast_attribute_guard , clingo_ast_attribute_head ,
  clingo_ast_attribute_include_type , clingo_ast_attribute_left , clingo_ast_attribute_literal , clingo_ast_attribute_location ,
  clingo_ast_attribute_modifier , clingo_ast_attribute_name , clingo_ast_attribute_operators , clingo_ast_attribute_operator_type ,
  clingo_ast_attribute_optimize_type , clingo_ast_attribute_pool , clingo_ast_attribute_priority , clingo_ast_attribute_relation ,
  clingo_ast_attribute_right , clingo_ast_attribute_script_type , clingo_ast_attribute_sign , clingo_ast_attribute_symbol ,
  clingo_ast_attribute_term , clingo_ast_attribute_terms , clingo_ast_attribute_theory_operator , clingo_ast_attribute_tuple ,
  clingo_ast_attribute_tuple_type , clingo_ast_attribute_u , clingo_ast_attribute_v , clingo_ast_attribute_value ,
  clingo_ast_attribute_weight
}
 Enumeration of attributes used by the AST.
 
enum  clingo_projection_mode_e { clingo_projection_mode_disabled = 0 , clingo_projection_mode_anonymous = 1 , clingo_projection_mode_pure = 2 }
 The available projection modes. More...
 

Functions

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_create (clingo_lib_t *lib, clingo_ast_rewrite_context_t **context)
 Create a new rewrite context.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_free (clingo_ast_rewrite_context_t *context)
 Free the given rewrite context.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_add_param (clingo_ast_rewrite_context_t *context, char const *param, size_t size)
 Protect the given parameter from simplifications.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_clear_params (clingo_ast_rewrite_context_t *context)
 Remove all previously added parameters.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_add_theory (clingo_ast_rewrite_context_t *context, clingo_ast_t const *theory)
 Add a theory definition to the rewrite context.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_set_project_anonymous (clingo_ast_rewrite_context_t *context, bool value)
 Configure whether anonymous variables in negative literals are projected.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_get_project_anonymous (clingo_ast_rewrite_context_t *context)
 Return whether anonymous variables in negative literals are projected.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_set_project_mode (clingo_ast_rewrite_context_t *context, clingo_projection_mode_t value)
 Configure the projection mode.
 
CLINGO_VISIBILITY_DEFAULT clingo_projection_mode_t clingo_ast_rewrite_context_get_project_mode (clingo_ast_rewrite_context_t *context)
 Get the configured projection mode.
 
CLINGO_VISIBILITY_DEFAULT clingo_lib_tclingo_ast_rewrite_context_get_lib (clingo_ast_rewrite_context_t *context)
 Get the library object used to create the context.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite (clingo_ast_rewrite_context_t *context, clingo_ast_t *statement, clingo_ast_t ***result, size_t *result_size)
 Rewrite the given statement.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_control_join (clingo_control_t *control, clingo_program_t const *program)
 Extend the control objects's program with the given one.
 

Functions to create/free ASTs

enum  clingo_ast_parse_type_e {
  clingo_ast_parse_type_term , clingo_ast_parse_type_theory_term , clingo_ast_parse_type_literal , clingo_ast_parse_type_body_literal ,
  clingo_ast_parse_type_head_literal , clingo_ast_parse_type_statement
}
 Enumeration of expressions that can be parsed.
 
typedef int clingo_ast_parse_type_t
 Corresponding type to clingo_ast_parse_type_e.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_construct (clingo_lib_t *lib, clingo_ast_type_t type, clingo_ast_t **ast,...)
 Construct an AST of the given type.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_copy (clingo_ast_t *ast, clingo_ast_t **copy)
 Copy the given AST node.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_expression (clingo_lib_t *lib, clingo_ast_parse_type_t type, char const *string, size_t size, clingo_ast_t **ast)
 Parse a single expression given as string.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_free (clingo_ast_t *ast)
 Free an AST node.
 
CLINGO_VISIBILITY_DEFAULT void clingo_ast_array_free (clingo_ast_t **ast, size_t size)
 Free an AST array.
 

Functions to scan ASTs

typedef bool(* clingo_ast_callback_t) (clingo_ast_t *ast, void *data)
 A callback to intercept ast's.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_string (clingo_lib_t *lib, char const *program, size_t size, clingo_control_t *control, clingo_ast_callback_t callback, void *data)
 Parse a program from a string.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_files (clingo_lib_t *lib, clingo_string_t const *files, size_t size, clingo_control_t *control, clingo_ast_callback_t callback, void *data)
 Parse a program from the given files.
 

Functions to convert ASTs to strings

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string (clingo_ast_t *ast, clingo_string_builder_t *builder)
 Get the string representation of an AST node.
 

Functions to compare ASTs

CLINGO_VISIBILITY_DEFAULT int clingo_ast_compare (clingo_ast_t *a, clingo_ast_t *b)
 Less than compare two AST nodes.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_equal (clingo_ast_t *a, clingo_ast_t *b)
 Equality compare two AST nodes.
 
CLINGO_VISIBILITY_DEFAULT size_t clingo_ast_hash (clingo_ast_t *ast)
 Compute a hash for an AST node.
 

Functions to inspect ASTs

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_get_type (clingo_ast_t *ast, clingo_ast_type_t *type)
 Get the type of an AST node.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_number (clingo_ast_t *ast, clingo_ast_attribute_t attribute, int *value)
 Get the value of numeric attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t *value)
 Get the value of a symbol attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_location (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_location_t const **value)
 Get the value of a location attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_string_t *value)
 Get the value of a string attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_string_t const **value, size_t *size)
 Get the value of a string array attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t const **value, size_t *size)
 Get the value of a symbol array attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t **value)
 Get the value of an ast attribute.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t ***value, size_t *size)
 Get the value of an ast array attribute.
 
CLINGO_VISIBILITY_DEFAULT char const * clingo_ast_type_info_yaml (void)
 Get a description of the AST structure in form of a YAML document.
 

Functions to add ASTs to logic programs

CLINGO_VISIBILITY_DEFAULT bool clingo_program_new (clingo_lib_t *lib, clingo_program_t **program)
 Create an empty non-ground program.
 
CLINGO_VISIBILITY_DEFAULT void clingo_program_free (clingo_program_t *program)
 Destroy the given program object.
 
CLINGO_VISIBILITY_DEFAULT bool clingo_program_add (clingo_program_t *program, clingo_ast_t *statement)
 Adds a statement to the program.
 

Detailed Description

Functions and data structures to work with program ASTs.

Typedef Documentation

◆ clingo_ast_callback_t

typedef bool(* clingo_ast_callback_t) (clingo_ast_t *ast, void *data)

A callback to intercept ast's.

Parameters
[in]astthe paresd ast
[in]datathe user data of the callback
Returns
whether the call was successful

Enumeration Type Documentation

◆ clingo_projection_mode_e

The available projection modes.

Enumerator
clingo_projection_mode_disabled 

Disable projection.

clingo_projection_mode_anonymous 

Only project anonymous variables.

clingo_projection_mode_pure 

Project pure variables.

Function Documentation

◆ clingo_ast_array_free()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_array_free ( clingo_ast_t **  ast,
size_t  size 
)

Free an AST array.

This also frees the individual ast's in the array using clingo_ast_free.

Parameters
[in]astthe target AST array
[in]sizethe size of the AST array

◆ clingo_ast_attribute_get_ast()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_ast_t **  value 
)

Get the value of an ast attribute.

The value will be set to NULL if an optional AST does not have a value.

Note
The resulting ast has to be freed using clingo_ast_free.
Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_ast_attribute_get_ast_array()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast_array ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_ast_t ***  value,
size_t *  size 
)

Get the value of an ast array attribute.

Note
The resulting array has to be freed using clingo_ast_array_free.
Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
[out]sizethe size of the array
Returns
wether the call was successful

◆ clingo_ast_attribute_get_location()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_location ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_location_t const **  value 
)

Get the value of a location attribute.

Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_ast_attribute_get_number()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_number ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
int *  value 
)

Get the value of numeric attribute.

Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_ast_attribute_get_string()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_string_t value 
)

Get the value of a string attribute.

Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_ast_attribute_get_string_array()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string_array ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_string_t const **  value,
size_t *  size 
)

Get the value of a string array attribute.

Note
The the required size of the array can be queried setting value to NULL.
Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
[out]sizethe size of the array
Returns
wether the call was successful

◆ clingo_ast_attribute_get_symbol()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_symbol_t value 
)

Get the value of a symbol attribute.

Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
Returns
wether the call was successful

◆ clingo_ast_attribute_get_symbol_array()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol_array ( clingo_ast_t ast,
clingo_ast_attribute_t  attribute,
clingo_symbol_t const **  value,
size_t *  size 
)

Get the value of a symbol array attribute.

Note
The the required size of the array can be queried setting value to NULL.
Parameters
[in]astthe target AST
[in]attributethe target attribute
[out]valuethe resulting value
[out]sizethe size of the array
Returns
wether the call was successful

◆ clingo_ast_compare()

CLINGO_VISIBILITY_DEFAULT int clingo_ast_compare ( clingo_ast_t a,
clingo_ast_t b 
)

Less than compare two AST nodes.

Parameters
[in]athe left-hand-side AST
[in]bthe right-hand-side AST
Returns
the result of the comparison

◆ clingo_ast_construct()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_construct ( clingo_lib_t lib,
clingo_ast_type_t  type,
clingo_ast_t **  ast,
  ... 
)

Construct an AST of the given type.

Parameters
[in]libthe library object to store symbols
[in]typethe type of AST to construct
[out]astthe resulting AST
Returns
wether the call was successful

◆ clingo_ast_copy()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_copy ( clingo_ast_t ast,
clingo_ast_t **  copy 
)

Copy the given AST node.

Parameters
[in]astthe AST to copy
[out]copythe resulting AST
Returns
wether the call was successful

◆ clingo_ast_equal()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_equal ( clingo_ast_t a,
clingo_ast_t b 
)

Equality compare two AST nodes.

Parameters
[in]athe left-hand-side AST
[in]bthe right-hand-side AST
Returns
the result of the comparison

◆ clingo_ast_free()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_free ( clingo_ast_t ast)

Free an AST node.

Parameters
[in]astthe target AST

◆ clingo_ast_get_type()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_get_type ( clingo_ast_t ast,
clingo_ast_type_t type 
)

Get the type of an AST node.

Parameters
[in]astthe target AST
[out]typethe resulting type
Returns
wether the call was successful

◆ clingo_ast_hash()

CLINGO_VISIBILITY_DEFAULT size_t clingo_ast_hash ( clingo_ast_t ast)

Compute a hash for an AST node.

Parameters
[in]astthe target AST
Returns
the resulting hash code

◆ clingo_ast_parse_expression()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_expression ( clingo_lib_t lib,
clingo_ast_parse_type_t  type,
char const *  string,
size_t  size,
clingo_ast_t **  ast 
)

Parse a single expression given as string.

Note
Parse errors are reported via the logger.
Parameters
[in]libthe library object to store symbols
[in]typethe expression type to parse
[in]stringthe expression to parse
[in]sizethe size of the string
[in]astthe resulting ast
Returns
wether the call was successful

◆ clingo_ast_parse_files()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_files ( clingo_lib_t lib,
clingo_string_t const *  files,
size_t  size,
clingo_control_t *  control,
clingo_ast_callback_t  callback,
void *  data 
)

Parse a program from the given files.

Parameters
[in]libthe library object to store symbols
[in]filesthe file paths to read from
[in]sizethe number of file paths
[in]controloptional control object to handle aspif
[in]callbackthe callback for the ast nodes
[in]datathe user data of the callback
Returns
whether the call was successful

◆ clingo_ast_parse_string()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_string ( clingo_lib_t lib,
char const *  program,
size_t  size,
clingo_control_t *  control,
clingo_ast_callback_t  callback,
void *  data 
)

Parse a program from a string.

Parameters
[in]libthe library object to store symbols
[in]programthe string to read from
[in]sizethe size of the string
[in]controloptional control object to handle aspif
[in]callbackthe callback for the ast nodes
[in]datathe user data of the callback
Returns
whether the call was successful

◆ clingo_ast_rewrite()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite ( clingo_ast_rewrite_context_t context,
clingo_ast_t statement,
clingo_ast_t ***  result,
size_t *  result_size 
)

Rewrite the given statement.

Note
The returned statements have to be freed using clingo_ast_array_free().
Parameters
[in]contextthe context object
[in]statementthe statement object
[out]resultthe resulting rewritten statements
[out]result_sizethe number of resulting statements
Returns
wether the call was successful

◆ clingo_ast_rewrite_context_add_param()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_add_param ( clingo_ast_rewrite_context_t context,
char const *  param,
size_t  size 
)

Protect the given parameter from simplifications.

Parameters from const and program statements should be protected.

Parameters
[in]contextthe context object
[in]paramthe parameter to protect
[in]sizethe size of the string
Returns
wether the call was successful

◆ clingo_ast_rewrite_context_add_theory()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_add_theory ( clingo_ast_rewrite_context_t context,
clingo_ast_t const *  theory 
)

Add a theory definition to the rewrite context.

Added definitions are used to rewrite theory atoms.

Parameters
[in]contextthe context object
[in]theorythe theory definition
Returns
wether the call was successful

◆ clingo_ast_rewrite_context_clear_params()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_clear_params ( clingo_ast_rewrite_context_t context)

Remove all previously added parameters.

Parameters
[in]contextthe context object

◆ clingo_ast_rewrite_context_create()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_create ( clingo_lib_t lib,
clingo_ast_rewrite_context_t **  context 
)

Create a new rewrite context.

Parameters
[in]libthe library object to store symbols
[out]contextthe resulting context object
Returns
wether the call was successful

◆ clingo_ast_rewrite_context_free()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_free ( clingo_ast_rewrite_context_t context)

Free the given rewrite context.

Parameters
[in]contextthe context to free

◆ clingo_ast_rewrite_context_get_lib()

CLINGO_VISIBILITY_DEFAULT clingo_lib_t * clingo_ast_rewrite_context_get_lib ( clingo_ast_rewrite_context_t context)

Get the library object used to create the context.

Parameters
[in]contextthe context object
Returns
the library object

◆ clingo_ast_rewrite_context_get_project_anonymous()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_rewrite_context_get_project_anonymous ( clingo_ast_rewrite_context_t context)

Return whether anonymous variables in negative literals are projected.

Parameters
[in]contextthe context object
Returns
whether anonymous variables in negative literals are projected

◆ clingo_ast_rewrite_context_get_project_mode()

CLINGO_VISIBILITY_DEFAULT clingo_projection_mode_t clingo_ast_rewrite_context_get_project_mode ( clingo_ast_rewrite_context_t context)

Get the configured projection mode.

Parameters
[in]contextthe context object
Returns
the projection mode

◆ clingo_ast_rewrite_context_set_project_anonymous()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_set_project_anonymous ( clingo_ast_rewrite_context_t context,
bool  value 
)

Configure whether anonymous variables in negative literals are projected.

Parameters
[in]contextthe context object
[in]valuewhether to enable projection

◆ clingo_ast_rewrite_context_set_project_mode()

CLINGO_VISIBILITY_DEFAULT void clingo_ast_rewrite_context_set_project_mode ( clingo_ast_rewrite_context_t context,
clingo_projection_mode_t  value 
)

Configure the projection mode.

Parameters
[in]contextthe context object
[in]valuethe projection mode

◆ clingo_ast_to_string()

CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string ( clingo_ast_t ast,
clingo_string_builder_t builder 
)

Get the string representation of an AST node.

Parameters
[in]astthe target AST
[in]builderthe string builder
Returns
wether the call was successful

◆ clingo_ast_type_info_yaml()

CLINGO_VISIBILITY_DEFAULT char const * clingo_ast_type_info_yaml ( void  )

Get a description of the AST structure in form of a YAML document.

Returns
A YAML string.

◆ clingo_control_join()

CLINGO_VISIBILITY_DEFAULT bool clingo_control_join ( clingo_control_t *  control,
clingo_program_t const *  program 
)

Extend the control objects's program with the given one.

After extending the logic program, the corresponding program parts are typically grounded with clingo_control_ground.

Parameters
[in]controlthe target
[in]programthe program to add
Returns
whether the call was successful

◆ clingo_program_add()

CLINGO_VISIBILITY_DEFAULT bool clingo_program_add ( clingo_program_t program,
clingo_ast_t statement 
)

Adds a statement to the program.

Parameters
[in]programthe target program
[in]statementthe statement to add
Returns
whether the call was successful

◆ clingo_program_free()

CLINGO_VISIBILITY_DEFAULT void clingo_program_free ( clingo_program_t program)

Destroy the given program object.

Parameters
[in]programthe program object

◆ clingo_program_new()

CLINGO_VISIBILITY_DEFAULT bool clingo_program_new ( clingo_lib_t lib,
clingo_program_t **  program 
)

Create an empty non-ground program.

Parameters
[in]libthe library object
[out]programthe program builder object
Returns
wether the call was successful