Clean up some comments.

This commit is contained in:
Danila Fedorin 2018-05-17 15:33:38 -07:00
parent c3a7657c71
commit 03cce8d1fb
5 changed files with 54 additions and 5 deletions

View File

@ -52,6 +52,7 @@ typedef struct libab_basetype_s libab_basetype;
* Initializes a base type, including all the parameters that it needs
* to take.
* @param basetype the type that is being initialized.
* @param free_function to function used to free the data in this basetype.
* @param n the number of type parameters it has.
* @param params the parameters this basetype accepts.
*/

View File

@ -32,7 +32,7 @@ enum libab_behavior_variant_e { BIMPL_INTERNAL, BIMPL_TREE };
*/
struct libab_behavior_s {
/**
* The variant of this implementation.
* The variant of this behavior.
*/
enum libab_behavior_variant_e variant;
union {
@ -98,7 +98,6 @@ typedef struct libab_function_s libab_function;
/**
* Initializes a behavior that uses an internal function.
* @param behavior the behavior to initialize.
* @param type the type of the behavior.
* @param func the function that this behavior calls.
*/
void libab_behavior_init_internal(libab_behavior* behavior,
@ -107,7 +106,6 @@ void libab_behavior_init_internal(libab_behavior* behavior,
* Initializes a behavior that uses a tree that has been
* parsed from the user.
* @param behavior the behavior to initialize.
* @param type the type of the behavior.
* @param tree the tree that this behavior uses.
*/
void libab_behavior_init_tree(libab_behavior* behavior, libab_tree* tree);
@ -137,7 +135,6 @@ void libab_operator_free(libab_operator* op);
/**
* Initializes a function with the given internal behavior.
* @param function the function to initialize.
* @param type the type of the function.
* @param fun the function implementation.
* @return the result of the initialization.
*/
@ -146,7 +143,6 @@ libab_result libab_function_init_internal(libab_function* function,
/**
* Initializes a function with the given tree behavior.
* @param function the function to initialize.
* @param type the type of the function.
* @param tree the tree that represents the function's behavior.
* @return the result of the initialization.
*/

View File

@ -3,15 +3,38 @@
#include "ref_vec.h"
/**
* A list of function values,
* returned if a name of an overloaded
* function is used.
*/
struct libab_function_list_s {
/**
* The function list.
*/
libab_ref_vec functions;
};
typedef struct libab_function_list_s libab_function_list;
/**
* Initializes a function list.
* @param list the list to intialize.
* @return the result of the initialization.
*/
libab_result libab_function_list_init(libab_function_list* list);
/**
* Inserts a new function value into the list.
* @param list the list to insert into.
* @param function_value the function value to insert.
* @return the result of the insertion.
*/
libab_result libab_function_list_insert(libab_function_list* list,
libab_ref* function_value);
/**
* Frees the given function list.
* @param list the list to free.
*/
void libab_function_list_free(libab_function_list* list);
#endif

View File

@ -8,15 +8,35 @@
struct libab_s;
/**
* The interpreter struct used to encapsulate
* any interpreter-specific data.
*/
struct libab_interpreter_s {
struct libab_s* ab;
};
typedef struct libab_interpreter_s libab_interpreter;
/**
* Initializes an interpreter instance.
* @param intr the interpreter to initialize.
* @param ab the libabacus instance this interpreter belongs to.
*/
void libab_interpreter_init(libab_interpreter* intr, struct libab_s* ab);
/**
* Uses the interpreter to run the given parse tree.
* @param intr the interpreter to use to run the code.
* @param tree the tree to run.
* @param into the reference into which the result of the execution will be stored.
* @return the result of the execution.
*/
libab_result libab_interpreter_run(libab_interpreter* intr, libab_tree* tree,
libab_ref* into);
/**
* Frees the given interpreter.
* @param intr the interpreter to free.
*/
void libab_interpreter_free(libab_interpreter* intr);
#endif

View File

@ -31,9 +31,18 @@ void libab_parser_init(libab_parser* parser, struct libab_s* ab);
* @param tokens the tokens to use for parsing.
* @param string the string to use for determining token values.
* @param store_into tree pointer to store the new data into.
* @return the result of parsing the tree.
*/
libab_result libab_parser_parse(libab_parser* parser, ll* tokens,
const char* string, libab_tree** store_into);
/**
* Parses a type into the given reference.
* @param parser the parser to use for parsing text.
* @param tokens the tokens to use for parsing.
* @param string the string from which the tokens came from.
* @param store_into the reference into which to place the type.
* @return the result of parsing the type.
*/
libab_result libab_parser_parse_type(libab_parser* parser, ll* tokens,
const char* string, libab_ref* store_into);
/**