Commit Graph

256 Commits

Author SHA1 Message Date
Danila Fedorin 82747eae6a Output error codes. 2018-06-20 13:55:28 -07:00
Danila Fedorin 6822c97750 Properly handle placeholder types. 2018-06-17 20:21:40 -07:00
Danila Fedorin 827dba9013 Add the libab prefix to free functions. 2018-06-17 19:43:18 -07:00
Danila Fedorin f83b7d169c Resolve function types when they're created. 2018-06-17 19:01:15 -07:00
Danila Fedorin b9b6a8ec4b Get basetype from table or type parameters if not resolved. 2018-06-17 18:20:40 -07:00
Danila Fedorin 05586069a7 Remove function resolving code. It will not be used. 2018-06-17 17:13:11 -07:00
Danila Fedorin 22b738a4f0 Add code to call tree functions. 2018-06-17 02:03:34 -07:00
Danila Fedorin 88ec979ba5 Add scope modes instead of a flag. 2018-06-17 01:25:41 -07:00
Danila Fedorin 763cfdd7a3 Search scope as well as type map for type parameters. 2018-06-17 00:12:51 -07:00
Danila Fedorin 065554bcdf Store type parameters into table during call. 2018-06-16 23:40:32 -07:00
Danila Fedorin 27c79d44f5 Add a foreach function to ref_trie. 2018-06-16 20:51:54 -07:00
Danila Fedorin 28f7cd1b30 Add creating tree functions. 2018-06-15 22:56:56 -07:00
Danila Fedorin 695fbed235 Put free functions into common header / source file. 2018-06-15 22:54:58 -07:00
Danila Fedorin 1158b29c1b Remove currently unused file. 2018-06-15 16:53:13 -07:00
Danila Fedorin 5492aa6f63 Change free condition for tree. 2018-06-13 23:28:42 -07:00
Danila Fedorin 59f306f59e Avoid hard crashes due to unfinished interpreter function. 2018-06-13 23:28:33 -07:00
Danila Fedorin 3fc90383a9 Increment refcount for tree when added to function. 2018-06-12 23:47:40 -07:00
Danila Fedorin 39dd07b134 Add pseudo-refcounting to tree creation. 2018-06-12 23:34:18 -07:00
Danila Fedorin b5b4d7816a Fix ref_vec reallocation. 2018-06-12 02:27:53 -07:00
Danila Fedorin dc9702df4c Fix memory allocation / free bugs. 2018-06-12 02:09:51 -07:00
Danila Fedorin 1438690b62 Add a partial application function. 2018-06-03 00:49:30 -07:00
Danila Fedorin 9b575916ff Create a new creation function for new initialization type. 2018-06-02 20:56:30 -07:00
Danila Fedorin cbd57f2585 Add new way to initialize functions. 2018-06-02 20:56:10 -07:00
Danila Fedorin 62dd41e634 Use the unit type correctly instead of null references. 2018-06-02 16:06:13 -07:00
Danila Fedorin 8207f1f450 Add unit value to interpreter. 2018-06-02 15:59:13 -07:00
Danila Fedorin 3fcdd55395 Use unit type in print function. 2018-06-02 15:37:15 -07:00
Danila Fedorin 969e457fba Add a unit type. 2018-06-02 15:37:04 -07:00
Danila Fedorin b7cc17d394 Remove debug printing. 2018-06-02 15:17:43 -07:00
Danila Fedorin 0db929b7f7 Fix functions remaining allocated after program exit. 2018-06-02 12:42:06 -07:00
Danila Fedorin 6080c3f250 Add a function to print the result of the evaluation. 2018-06-01 23:39:23 -07:00
Danila Fedorin f199bc6efd Add a function to call a function by name. 2018-06-01 23:32:19 -07:00
Danila Fedorin c2ec44d83b Create a macro for basic infix operators. 2018-06-01 15:33:45 -07:00
Danila Fedorin 5fec3bd63c Make operators simply aliases to functions. 2018-06-01 15:24:55 -07:00
Danila Fedorin 6cc43449c5 Clear root scope on free to prevent internal function circular refs. 2018-05-31 19:45:36 -07:00
Danila Fedorin 19416d0e15 Add clear functions to table and trie. 2018-05-31 19:29:14 -07:00
Danila Fedorin 34b97e42ac Add scopes to functions. 2018-05-28 01:18:06 -07:00
Danila Fedorin 031e6434c5 Add a new table entry type. 2018-05-27 23:10:59 -07:00
Danila Fedorin b0a25fd53f Add comments to the various function calling functions.
There are a lot of them, and they're fairly arcane.
2018-05-27 18:09:28 -07:00
Danila Fedorin 99c36be175 Free temporary parameters. 2018-05-27 14:05:51 -07:00
Danila Fedorin 97fed0b4d1 Use new type functions and abstract reusable code. 2018-05-27 00:12:13 -07:00
Danila Fedorin 1f8788dd32 Add functions for getting special types. 2018-05-27 00:11:00 -07:00
Danila Fedorin 1f7294ce29 Add libabacus parameter to function calls. 2018-05-27 00:02:20 -07:00
Danila Fedorin f4de244c41 Format code. 2018-05-26 21:55:30 -07:00
Danila Fedorin a6aaa22450 Add calling operators. 2018-05-26 20:43:36 -07:00
Danila Fedorin 280bc60da4 Generalize type checking function in preparation for operators. 2018-05-26 19:27:27 -07:00
Danila Fedorin a117d7854b Add calling into the interpreter's tree code. 2018-05-26 15:58:06 -07:00
Danila Fedorin fb55e20e84 Add utilities to reuse common internal function code. 2018-05-26 15:04:28 -07:00
Danila Fedorin 88b32ef58d Add function to call function, instead of function list. 2018-05-26 15:03:57 -07:00
Danila Fedorin bbe31be447 Add an interactive test target. 2018-05-23 15:41:17 -07:00
Danila Fedorin 9db667dcdf Fix bugs in the call implementation. 2018-05-22 20:16:06 -07:00
Danila Fedorin 1cd7f3f45a Finish the draft implementation. 2018-05-22 17:45:32 -07:00
Danila Fedorin 070dc179ff Add beginnings of function calling code. 2018-05-22 15:21:10 -07:00
Danila Fedorin 2a1d51ae78 Add additional result types and change some code to use appropriate types. 2018-05-22 13:03:14 -07:00
Danila Fedorin 680f65d2e6 Add additional functions to ref_vec. 2018-05-22 12:44:15 -07:00
Danila Fedorin 72e143396c Add two utility functions to function_list. 2018-05-20 09:56:24 -07:00
Danila Fedorin 8a7c18b513 Disallow non-leaf template types. 2018-05-19 13:04:41 -07:00
Danila Fedorin a6029d7ef4 Add utility function for executing code. 2018-05-18 14:15:15 -07:00
Danila Fedorin c3a7657c71 Format code. 2018-05-17 14:53:48 -07:00
Danila Fedorin 97543a3d19 Remove unused nesting in behavior struct. 2018-05-16 23:10:33 -07:00
Danila Fedorin 325c9b9ef7 Add a type specifically to operators. 2018-05-16 15:30:29 -07:00
Danila Fedorin 47a57d66ee Remove types from behavior structs. 2018-05-16 15:26:03 -07:00
Danila Fedorin 48f8d09405 Make table searching functions public to prevent their duplication. 2018-05-16 14:05:35 -07:00
Danila Fedorin 70e0e75d24 Switch to using values for storing function entries. 2018-05-14 21:32:36 -07:00
Danila Fedorin b96d1804aa Change the behavior of create_function_list to be consistent. 2018-05-14 20:15:03 -07:00
Danila Fedorin e7f3a9384e Add functions to allocate function structs. 2018-05-14 19:17:03 -07:00
Danila Fedorin 85f88b909b Add a swap function that swaps contents of references. 2018-05-14 19:16:42 -07:00
Danila Fedorin df50579b5c Make refcounted returns move consistent. 2018-05-14 18:34:30 -07:00
Danila Fedorin c3f413d087 Fix bug in parser causing additional frees. 2018-05-14 17:46:11 -07:00
Danila Fedorin cf3136a237 Switch values to having their data refcounted separately.
This allows for values to be "cast" and have a different type, while
still referencing the same data.
2018-05-14 17:41:41 -07:00
Danila Fedorin 3e8c814215 Remove pointless parameter copying. 2018-05-11 20:36:27 -07:00
Danila Fedorin 989774cec5 Add methods to get pointers to basetypes, for comparison. 2018-05-11 20:12:03 -07:00
Danila Fedorin 8f48a16a25 Add the ability to copy a ref trie. 2018-05-11 14:40:01 -07:00
Danila Fedorin 92186911ad Add type parameters to behavior. 2018-05-11 11:38:10 -07:00
Danila Fedorin 8253cd1f69 Add initialization functions for operators and functions. 2018-05-09 15:05:40 -07:00
Danila Fedorin 3b0908125d Avoid creating number type reference in interpreter. 2018-05-06 19:01:47 -07:00
Danila Fedorin 1e215ecfa5 Add a function for preparing for execution. 2018-05-06 18:45:07 -07:00
Danila Fedorin 51e9a11a1f Add utility function to store a value into a table. 2018-04-26 20:59:12 -07:00
Danila Fedorin edcd5fc5ae Add the ability to store values into the table. 2018-04-26 20:51:54 -07:00
Danila Fedorin 785a362f97 Add a function list that's used for searching functions by name. 2018-04-26 19:40:21 -07:00
Danila Fedorin c46b82584d Add a new code branch for numbers and void values. 2018-04-24 18:29:17 -07:00
Danila Fedorin 78d24de152 Free type after retrieving necessary information. 2018-04-24 18:28:31 -07:00
Danila Fedorin 2f6176630f Make basetype take a free function. 2018-04-24 18:28:20 -07:00
Danila Fedorin 0a24fff344 Add a new implementation struct with only one function. 2018-04-24 16:59:53 -07:00
Danila Fedorin 14e9ddea23 Remove the implementation struct. 2018-04-24 16:34:10 -07:00
Danila Fedorin 735e8715a8 Add a function to create a value reference wrapper. 2018-04-24 15:22:17 -07:00
Danila Fedorin ee76d39f38 Remove un-thread safe shared reference count. 2018-04-24 15:08:39 -07:00
Danila Fedorin 4dcf422757 Prevent infinite loop in block interpretation. 2018-04-24 11:47:50 -07:00
Danila Fedorin 46040531fb Add interpreter to libab. 2018-04-24 11:35:27 -07:00
Danila Fedorin a86938b574 Use reference counted table in libab. 2018-04-24 11:35:16 -07:00
Danila Fedorin cea057aaa6 Switch tables to use refcounting. 2018-04-24 11:13:47 -07:00
Danila Fedorin 251ce4e66e Start the interpreter code. Construct a basic scaffold. 2018-04-23 14:49:33 -07:00
Danila Fedorin 43a22d7492 Ensure reference is always initialized. 2018-04-22 21:24:43 -07:00
Danila Fedorin ac26c4dbd0 Add a function to construct and wrap a parsetype in a refcount. 2018-04-22 20:44:30 -07:00
Danila Fedorin db84019846 Add a way to construct a parsetype form existing types and a basetype. 2018-04-22 20:44:08 -07:00
Danila Fedorin d096e2155c Remove the free assumption from libab_ref. 2018-04-21 17:05:51 -07:00
Danila Fedorin 5d3130d39d Format the code with clang-format. 2018-04-21 14:09:01 -07:00
Danila Fedorin 22ed67f0a4 Add a description of the internal array data structure. 2018-04-21 13:54:28 -07:00
Danila Fedorin 30578f27da Take precompiled type in register functions. User must call create_type. 2018-04-20 14:54:58 -07:00
Danila Fedorin 7692d4541f Add function to compile a type from its string. 2018-04-20 14:54:23 -07:00
Danila Fedorin 8214aa8344 Allow tree-based function implementations. 2018-04-20 09:26:18 -07:00