8#include <clingo/core.h>
9#include <clingo/symbol.h>
11typedef struct clingo_control clingo_control_t;
39 clingo_ast_type_projection,
40 clingo_ast_type_term_variable,
41 clingo_ast_type_term_symbolic,
42 clingo_ast_type_term_absolute,
43 clingo_ast_type_term_unary_operation,
44 clingo_ast_type_term_binary_operation,
45 clingo_ast_type_term_tuple,
46 clingo_ast_type_term_function,
47 clingo_ast_type_argument_tuple,
49 clingo_ast_type_unparsed_element,
50 clingo_ast_type_theory_term_variable,
51 clingo_ast_type_theory_term_symbolic,
52 clingo_ast_type_theory_term_tuple,
53 clingo_ast_type_theory_term_function,
54 clingo_ast_type_theory_term_unparsed,
56 clingo_ast_type_left_guard,
57 clingo_ast_type_right_guard,
58 clingo_ast_type_literal_boolean,
59 clingo_ast_type_literal_comparison,
60 clingo_ast_type_literal_symbolic,
62 clingo_ast_type_set_aggregate_element,
63 clingo_ast_type_theory_atom_element,
64 clingo_ast_type_theory_right_guard,
66 clingo_ast_type_body_simple_literal,
67 clingo_ast_type_body_aggregate_element,
68 clingo_ast_type_body_aggregate,
69 clingo_ast_type_body_set_aggregate,
70 clingo_ast_type_body_theory_atom,
71 clingo_ast_type_body_conditional_literal,
73 clingo_ast_type_head_simple_literal,
74 clingo_ast_type_head_aggregate_element,
75 clingo_ast_type_head_aggregate,
76 clingo_ast_type_head_set_aggregate,
77 clingo_ast_type_head_theory_atom,
78 clingo_ast_type_head_conditional_literal,
79 clingo_ast_type_head_disjunction,
81 clingo_ast_type_theory_operator_definition,
82 clingo_ast_type_theory_term_definition,
83 clingo_ast_type_theory_guard_definition,
84 clingo_ast_type_theory_atom_definition,
86 clingo_ast_type_optimize_tuple,
87 clingo_ast_type_optimize_element,
89 clingo_ast_type_program_part,
91 clingo_ast_type_statement_rule,
92 clingo_ast_type_statement_theory,
93 clingo_ast_type_statement_optimize,
94 clingo_ast_type_statement_weak_constraint,
95 clingo_ast_type_statement_show,
96 clingo_ast_type_statement_show_nothing,
97 clingo_ast_type_statement_show_signature,
98 clingo_ast_type_statement_project,
99 clingo_ast_type_statement_project_signature,
100 clingo_ast_type_statement_defined,
101 clingo_ast_type_statement_external,
102 clingo_ast_type_statement_edge,
103 clingo_ast_type_statement_heuristic,
104 clingo_ast_type_statement_script,
105 clingo_ast_type_statement_program,
106 clingo_ast_type_statement_include,
107 clingo_ast_type_statement_const,
108 clingo_ast_type_statement_parts,
109 clingo_ast_type_statement_comment
116 clingo_ast_attribute_anonymous,
117 clingo_ast_attribute_arguments,
118 clingo_ast_attribute_arity,
119 clingo_ast_attribute_atom,
120 clingo_ast_attribute_atoms,
121 clingo_ast_attribute_atom_type,
122 clingo_ast_attribute_body,
123 clingo_ast_attribute_comment_type,
124 clingo_ast_attribute_condition,
125 clingo_ast_attribute_precedence,
126 clingo_ast_attribute_elements,
127 clingo_ast_attribute_external,
128 clingo_ast_attribute_external_type,
129 clingo_ast_attribute_function,
130 clingo_ast_attribute_guard,
131 clingo_ast_attribute_head,
132 clingo_ast_attribute_include_type,
133 clingo_ast_attribute_left,
134 clingo_ast_attribute_literal,
135 clingo_ast_attribute_location,
136 clingo_ast_attribute_modifier,
137 clingo_ast_attribute_name,
138 clingo_ast_attribute_operators,
139 clingo_ast_attribute_operator_type,
140 clingo_ast_attribute_optimize_type,
141 clingo_ast_attribute_pool,
142 clingo_ast_attribute_priority,
143 clingo_ast_attribute_relation,
144 clingo_ast_attribute_right,
145 clingo_ast_attribute_script_type,
146 clingo_ast_attribute_sign,
147 clingo_ast_attribute_symbol,
148 clingo_ast_attribute_term,
149 clingo_ast_attribute_terms,
150 clingo_ast_attribute_theory_operator,
151 clingo_ast_attribute_tuple,
152 clingo_ast_attribute_tuple_type,
153 clingo_ast_attribute_u,
154 clingo_ast_attribute_v,
155 clingo_ast_attribute_value,
156 clingo_ast_attribute_weight,
185 clingo_ast_parse_type_term,
186 clingo_ast_parse_type_theory_term,
187 clingo_ast_parse_type_literal,
188 clingo_ast_parse_type_body_literal,
189 clingo_ast_parse_type_head_literal,
190 clingo_ast_parse_type_statement,
436 char const *param,
size_t size);
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 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.
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 void clingo_program_free(clingo_program_t *program)
Destroy the given program object.
struct clingo_ast clingo_ast_t
This struct provides a view to nodes in the AST.
Definition ast.h:163
struct clingo_program clingo_program_t
Object to store.
Definition ast.h:499
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 clingo_lib_t * clingo_ast_rewrite_context_get_lib(clingo_ast_rewrite_context_t *context)
Get the library object used to create the context.
int clingo_ast_type_t
Corresponding type to clingo_ast_type_e.
Definition ast.h:112
CLINGO_VISIBILITY_DEFAULT bool clingo_program_new(clingo_lib_t *lib, clingo_program_t **program)
Create an empty non-ground program.
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 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 void clingo_ast_free(clingo_ast_t *ast)
Free an AST node.
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.
int clingo_ast_attribute_t
Corresponding type to clingo_ast_attribute_e.
Definition ast.h:160
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.
int clingo_ast_parse_type_t
Corresponding type to clingo_ast_parse_type_e.
Definition ast.h:193
struct clingo_ast_rewrite_context clingo_ast_rewrite_context_t
Context object to rewrite statements.
Definition ast.h:412
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_program_add(clingo_program_t *program, clingo_ast_t *statement)
Adds a statement to the program.
clingo_ast_type_e
Enumeration of AST types.
Definition ast.h:37
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_equal(clingo_ast_t *a, clingo_ast_t *b)
Equality compare two AST nodes.
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.
int clingo_projection_mode_t
Corresponding type to clingo_projection_mode_e.
Definition ast.h:409
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_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 void clingo_ast_rewrite_context_clear_params(clingo_ast_rewrite_context_t *context)
Remove all previously added parameters.
clingo_projection_mode_e
The available projection modes.
Definition ast.h:403
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 bool clingo_ast_get_type(clingo_ast_t *ast, clingo_ast_type_t *type)
Get the type of an AST node.
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 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 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 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_ast_parse_type_e
Enumeration of expressions that can be parsed.
Definition ast.h:184
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_theory(clingo_ast_rewrite_context_t *context, clingo_ast_t const *theory)
Add a theory definition to the rewrite context.
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.
bool(* clingo_ast_callback_t)(clingo_ast_t *ast, void *data)
A callback to intercept ast's.
Definition ast.h:372
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.
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_copy(clingo_ast_t *ast, clingo_ast_t **copy)
Copy the given AST node.
clingo_ast_attribute_e
Enumeration of attributes used by the AST.
Definition ast.h:115
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 char const * clingo_ast_type_info_yaml(void)
Get a description of the AST structure in form of a YAML document.
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_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 size_t clingo_ast_hash(clingo_ast_t *ast)
Compute a hash for an AST node.
CLINGO_VISIBILITY_DEFAULT void clingo_ast_array_free(clingo_ast_t **ast, size_t size)
Free an AST array.
@ clingo_projection_mode_disabled
Disable projection.
Definition ast.h:404
@ clingo_projection_mode_pure
Project pure variables.
Definition ast.h:406
@ clingo_projection_mode_anonymous
Only project anonymous variables.
Definition ast.h:405
struct clingo_lib clingo_lib_t
A library object storing global information.
Definition core.h:176
struct clingo_location clingo_location_t
Represents a source code location marking its beginning and end.
Definition core.h:359
struct clingo_string_builder clingo_string_builder_t
A builder for strings.
Definition core.h:257
uint64_t clingo_symbol_t
Type to represent a symbol.
Definition symbol.h:51
Struct to capture strings that are not null-terminated.
Definition core.h:91