Commit Graph

155 Commits

Author SHA1 Message Date
325c9b9ef7 Add a type specifically to operators. 2018-05-16 15:30:29 -07:00
47a57d66ee Remove types from behavior structs. 2018-05-16 15:26:03 -07:00
48f8d09405 Make table searching functions public to prevent their duplication. 2018-05-16 14:05:35 -07:00
70e0e75d24 Switch to using values for storing function entries. 2018-05-14 21:32:36 -07:00
e7f3a9384e Add functions to allocate function structs. 2018-05-14 19:17:03 -07:00
85f88b909b Add a swap function that swaps contents of references. 2018-05-14 19:16:42 -07:00
df50579b5c Make refcounted returns move consistent. 2018-05-14 18:34:30 -07:00
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
3e8c814215 Remove pointless parameter copying. 2018-05-11 20:36:27 -07:00
989774cec5 Add methods to get pointers to basetypes, for comparison. 2018-05-11 20:12:03 -07:00
8f48a16a25 Add the ability to copy a ref trie. 2018-05-11 14:40:01 -07:00
92186911ad Add type parameters to behavior. 2018-05-11 11:38:10 -07:00
8253cd1f69 Add initialization functions for operators and functions. 2018-05-09 15:05:40 -07:00
3b0908125d Avoid creating number type reference in interpreter. 2018-05-06 19:01:47 -07:00
1e215ecfa5 Add a function for preparing for execution. 2018-05-06 18:45:07 -07:00
51e9a11a1f Add utility function to store a value into a table. 2018-04-26 20:59:12 -07:00
edcd5fc5ae Add the ability to store values into the table. 2018-04-26 20:51:54 -07:00
785a362f97 Add a function list that's used for searching functions by name. 2018-04-26 19:40:21 -07:00
2f6176630f Make basetype take a free function. 2018-04-24 18:28:20 -07:00
0a24fff344 Add a new implementation struct with only one function. 2018-04-24 16:59:53 -07:00
14e9ddea23 Remove the implementation struct. 2018-04-24 16:34:10 -07:00
735e8715a8 Add a function to create a value reference wrapper. 2018-04-24 15:22:17 -07:00
ee76d39f38 Remove un-thread safe shared reference count. 2018-04-24 15:08:39 -07:00
46040531fb Add interpreter to libab. 2018-04-24 11:35:27 -07:00
a86938b574 Use reference counted table in libab. 2018-04-24 11:35:16 -07:00
cea057aaa6 Switch tables to use refcounting. 2018-04-24 11:13:47 -07:00
251ce4e66e Start the interpreter code. Construct a basic scaffold. 2018-04-23 14:49:33 -07:00
ac26c4dbd0 Add a function to construct and wrap a parsetype in a refcount. 2018-04-22 20:44:30 -07:00
db84019846 Add a way to construct a parsetype form existing types and a basetype. 2018-04-22 20:44:08 -07:00
b12f6d7a31 Add a number implementation struct to libab. 2018-04-21 17:32:38 -07:00
596e1419b4 Revert "Add a description of the internal array data structure."
Let's focus on the core features, and add the fluff later.
2018-04-21 17:14:41 -07:00
d096e2155c Remove the free assumption from libab_ref. 2018-04-21 17:05:51 -07:00
5d3130d39d Format the code with clang-format. 2018-04-21 14:09:01 -07:00
22ed67f0a4 Add a description of the internal array data structure. 2018-04-21 13:54:28 -07:00
7692d4541f Add function to compile a type from its string. 2018-04-20 14:54:23 -07:00
8214aa8344 Allow tree-based function implementations. 2018-04-20 09:26:18 -07:00
576f805bd7 Implement resolving basetypes. 2018-04-19 23:17:54 -07:00
3ada78a557 Use reference counting for types. 2018-04-17 22:14:28 -07:00
264f420186 Merge type and parsetype into a single struct.
It doesn't make sense to re-create the same structure, or even
re-allocated any of the memory.
2018-04-17 15:49:09 -07:00
ade89ebf79 Remove unused base type variant. 2018-04-17 12:55:41 -07:00
be670a659f Add results for bad types. 2018-04-17 12:55:30 -07:00
7b1445a262 Add functions for basetypes and their entries in tables. 2018-04-17 12:07:22 -07:00
b1a113a57d Add free function for freeing the custom structs. 2018-04-17 12:05:48 -07:00
af87c6646d Add initial implementation of types and values. 2018-04-12 23:54:58 -07:00
d146b71e56 Add an implementation of base types.
These will hold information about a type such as (possibly) the
interfaces it implements and the parameters it accepts.
2018-04-12 23:45:30 -07:00
0cfc1df02c Add placeholder types. 2018-04-07 14:50:06 -07:00
1960ded070 Add initial implementation of a reference counting trie. 2018-04-06 23:55:56 -07:00
dabab1e870 Add a null reference that doesn't call malloc. 2018-04-06 23:53:40 -07:00
60d22c2511 Remove types, while their implementation is not thought out. 2018-04-01 00:18:53 -07:00
e6801255fa Add a vector of reference counted values. 2018-03-31 22:18:36 -07:00
35fc0e7fd1 Begin the implementation of a type. 2018-03-31 15:54:59 -07:00
c5fa68fdf5 Implement an initial version of reference counting. 2018-03-30 22:37:30 -07:00
7dd81f5e9b Remove unused (and non-existent) header from code. 2018-03-30 20:51:11 -07:00
26ad341a50 Switch the table to using tries. 2018-03-24 20:47:34 -07:00
56c891f9f8 Implement foreach for the trie. 2018-03-24 20:40:42 -07:00
7afe1a37e4 Implement a trie, sans removal. 2018-03-24 02:01:39 -07:00
77123561f0 Add a function to check if a tree node has a scope. 2018-03-24 00:36:10 -07:00
9500a6f9b0 Make a single "operator" token, and specialize after parse. 2018-03-17 20:56:25 -07:00
7ab5eba529 Make distinction between prefix and postfix unary operators in trees. 2018-03-17 18:25:23 -07:00
4e86ccc253 Use new table features to improve searching for operators. 2018-03-17 18:01:52 -07:00
6b438dbc6d Store the operator type in the corresponding table entry. 2018-03-17 17:38:13 -07:00
c131fbc758 Implement reserved operator parsing. 2018-03-16 23:09:41 -07:00
27acfb0be7 Register reserved operators as tokens. 2018-03-16 23:09:11 -07:00
d25c1a379a Add function to search for reserved operators. 2018-03-16 22:11:48 -07:00
ab2311def9 Store function / operator types when they are registered. 2018-03-15 19:41:11 -07:00
429c0bde3e Add syntax sugar for let. 2018-03-14 13:30:20 -07:00
bb61dbcd54 Add support for the return keyword. 2018-03-08 21:31:24 -08:00
f3f1cc8c43 Rename all the tree enums to have a prefix.
This prevents some possible naming collisions.
2018-03-08 21:13:25 -08:00
2d26e45e90 Add function node parsing. 2018-03-08 21:10:05 -08:00
2487cdebe0 Add the ability to parse types.
This ability is not integrated with the rest of the parser - in fact, the grammar for things like function declarations (where type declarations are necessary) is not yet determined.
2018-03-06 16:47:11 -08:00
45d955b8bd Add utility functions for copying strings. 2018-03-06 16:45:55 -08:00
bb26405df0 Add a parse type struct, used to hold type data as it is parsed. 2018-03-06 16:45:43 -08:00
ac8e2ff418 Implement the do-while loop. 2018-02-27 12:30:37 -08:00
976b6d1b1a Add code to parse while loops. 2018-02-27 11:57:45 -08:00
127a59ba50 Add comments to the debug header. 2018-02-27 11:08:14 -08:00
08513a2315 Add function to print to file. 2018-02-26 18:14:31 -08:00
65071d47b3 Add a function to print the parse tree. 2018-02-25 23:09:35 -08:00
88108bb3c0 Make the has string and has vector functions public. 2018-02-25 22:57:45 -08:00
52ac67026f Remove function tokens. If functions are first class, they're variables. 2018-02-25 14:12:34 -08:00
7a84babf1e Add basic function call parsing. 2018-02-24 20:08:17 -08:00
e5c2570bac Implement parsing if expressions. 2018-02-20 16:38:02 -08:00
8ffcbb0ee2 Make blocks expressions, and add implicit void expression at block ends. 2018-02-18 21:05:06 -08:00
96b2dc234f Remove currently unused node types from the tree code. 2018-02-18 19:42:54 -08:00
07284d1fb2 Add a table entry free function. 2018-02-17 19:53:33 -08:00
811704be25 Add a recursive tree freeing function. 2018-02-17 19:20:10 -08:00
b1aa2a4bf5 Implement associativity storage for operators. 2018-02-17 16:00:39 -08:00
8cd1d23120 Add functions to separately register different types of operators. 2018-02-17 14:01:48 -08:00
a3ce8fbd9c Tone down the current token list, in favor of adding them later. 2018-02-17 13:32:55 -08:00
841c2f15e5 Add function to free tree nodes. 2018-02-17 12:55:50 -08:00
ee19f55058 Implement convenience functions for looking up the implemented entries. 2018-02-11 23:00:07 -08:00
72be209f0f Implement two entry types and a function to store entries in table. 2018-02-11 22:50:08 -08:00
3de3f1ec00 Move structs used to hold custom operators and functions into new header 2018-02-11 22:38:40 -08:00
74034c7b76 Rename header files. 2018-02-11 22:32:42 -08:00
f67b98d7a6 Add a parser struct. 2018-02-11 22:26:19 -08:00
37a6f31b5f Start the overarching library code, and move result enum elsewhere. 2018-02-11 22:11:33 -08:00
e5351c17a2 Fix code to stick to proper naming convention. 2018-02-11 21:22:01 -08:00
0958ecd1eb Begin working on an initial implementation for the parser. 2018-02-10 22:40:34 -08:00
6d836a5513 Add parser state code and skeleton for the parsing procedure. 2018-02-10 22:22:51 -08:00
03f27bda18 Write a basic tree header file to hold the structure of the parsed code. 2018-02-10 22:15:51 -08:00
1a6a80d26b Add the search feature. 2018-02-10 17:57:24 -08:00