Commit Graph

256 Commits

Author SHA1 Message Date
Danila Fedorin 576f805bd7 Implement resolving basetypes. 2018-04-19 23:17:54 -07:00
Danila Fedorin 3ada78a557 Use reference counting for types. 2018-04-17 22:14:28 -07:00
Danila Fedorin 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
Danila Fedorin 7b1445a262 Add functions for basetypes and their entries in tables. 2018-04-17 12:07:22 -07:00
Danila Fedorin b1a113a57d Add free function for freeing the custom structs. 2018-04-17 12:05:48 -07:00
Danila Fedorin af87c6646d Add initial implementation of types and values. 2018-04-12 23:54:58 -07:00
Danila Fedorin 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
Danila Fedorin 0cfc1df02c Add placeholder types. 2018-04-07 14:50:06 -07:00
Danila Fedorin 1960ded070 Add initial implementation of a reference counting trie. 2018-04-06 23:55:56 -07:00
Danila Fedorin dabab1e870 Add a null reference that doesn't call malloc. 2018-04-06 23:53:40 -07:00
Danila Fedorin 60d22c2511 Remove types, while their implementation is not thought out. 2018-04-01 00:18:53 -07:00
Danila Fedorin e6801255fa Add a vector of reference counted values. 2018-03-31 22:18:36 -07:00
Danila Fedorin 35fc0e7fd1 Begin the implementation of a type. 2018-03-31 15:54:59 -07:00
Danila Fedorin c5fa68fdf5 Implement an initial version of reference counting. 2018-03-30 22:37:30 -07:00
Danila Fedorin 26ad341a50 Switch the table to using tries. 2018-03-24 20:47:34 -07:00
Danila Fedorin 56c891f9f8 Implement foreach for the trie. 2018-03-24 20:40:42 -07:00
Danila Fedorin dfcda0d6c3 Update liblex and libds. 2018-03-24 16:55:54 -07:00
Danila Fedorin 7afe1a37e4 Implement a trie, sans removal. 2018-03-24 02:01:39 -07:00
Danila Fedorin 77123561f0 Add a function to check if a tree node has a scope. 2018-03-24 00:36:10 -07:00
Danila Fedorin b6ab42f53a Check for NULL where tree can be NULL. 2018-03-18 23:42:49 -07:00
Danila Fedorin 94f1a11f15 Replace C++-style comments with C90 compatible ones. 2018-03-18 19:21:09 -07:00
Danila Fedorin 9500a6f9b0 Make a single "operator" token, and specialize after parse. 2018-03-17 20:56:25 -07:00
Danila Fedorin 156c02908d Allow operators to mean different things despite having the same string. 2018-03-17 18:32:49 -07:00
Danila Fedorin 7ab5eba529 Make distinction between prefix and postfix unary operators in trees. 2018-03-17 18:25:23 -07:00
Danila Fedorin 4e86ccc253 Use new table features to improve searching for operators. 2018-03-17 18:01:52 -07:00
Danila Fedorin 6b438dbc6d Store the operator type in the corresponding table entry. 2018-03-17 17:38:13 -07:00
Danila Fedorin 7d3ec550e8 Fix bug causing incorrect handling of prefix operators. 2018-03-17 15:31:14 -07:00
Danila Fedorin c131fbc758 Implement reserved operator parsing. 2018-03-16 23:09:41 -07:00
Danila Fedorin 27acfb0be7 Register reserved operators as tokens. 2018-03-16 23:09:11 -07:00
Danila Fedorin d25c1a379a Add function to search for reserved operators. 2018-03-16 22:11:48 -07:00
Danila Fedorin ab2311def9 Store function / operator types when they are registered. 2018-03-15 19:41:11 -07:00
Danila Fedorin 429c0bde3e Add syntax sugar for let. 2018-03-14 13:30:20 -07:00
Danila Fedorin bb61dbcd54 Add support for the return keyword. 2018-03-08 21:31:24 -08:00
Danila Fedorin f3f1cc8c43 Rename all the tree enums to have a prefix.
This prevents some possible naming collisions.
2018-03-08 21:13:25 -08:00
Danila Fedorin 2d26e45e90 Add function node parsing. 2018-03-08 21:10:05 -08:00
Danila Fedorin 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
Danila Fedorin 45d955b8bd Add utility functions for copying strings. 2018-03-06 16:45:55 -08:00
Danila Fedorin bb26405df0 Add a parse type struct, used to hold type data as it is parsed. 2018-03-06 16:45:43 -08:00
Danila Fedorin ac8e2ff418 Implement the do-while loop. 2018-02-27 12:30:37 -08:00
Danila Fedorin 976b6d1b1a Add code to parse while loops. 2018-02-27 11:57:45 -08:00
Danila Fedorin 1d0ea602a5 Make expression parsing parse more valid syntax. 2018-02-27 11:45:51 -08:00
Danila Fedorin c8ec93880e Add a macro to considerably simplify child parsing code. 2018-02-27 11:29:59 -08:00
Danila Fedorin 08513a2315 Add function to print to file. 2018-02-26 18:14:31 -08:00
Danila Fedorin 2823b0b66b Fix bug in order of operations processing. 2018-02-26 13:51:37 -08:00
Danila Fedorin 65071d47b3 Add a function to print the parse tree. 2018-02-25 23:09:35 -08:00
Danila Fedorin c18a5e49de Add the call node as one of the nodes that contains a vector. 2018-02-25 23:09:13 -08:00
Danila Fedorin 88108bb3c0 Make the has string and has vector functions public. 2018-02-25 22:57:45 -08:00
Danila Fedorin 52ac67026f Remove function tokens. If functions are first class, they're variables. 2018-02-25 14:12:34 -08:00
Danila Fedorin 7a84babf1e Add basic function call parsing. 2018-02-24 20:08:17 -08:00
Danila Fedorin 052fc5b943 Fix bugs in the if-statement parser. 2018-02-24 20:07:54 -08:00
Danila Fedorin b19adef236 Abstract creating nodes with both strings and vectors. 2018-02-24 20:07:44 -08:00
Danila Fedorin d26cb6283c Fix bug causing incorrect postfix parsing. 2018-02-21 19:16:42 -08:00
Danila Fedorin a3e1fdd46e Clean up code in places suggested by static analysis. 2018-02-21 19:06:00 -08:00
Danila Fedorin 0541c18a91 Fix bug causing the free function miss freeing a vector. 2018-02-21 19:00:04 -08:00
Danila Fedorin 6c111f9b67 Fix another unnecessary free bug. 2018-02-21 18:58:32 -08:00
Danila Fedorin 160c0a93da Make token reporting work for EOF. 2018-02-21 18:55:05 -08:00
Danila Fedorin 919cfb495c Fix segmentation fault causing bugs. 2018-02-21 18:54:52 -08:00
Danila Fedorin e5c2570bac Implement parsing if expressions. 2018-02-20 16:38:02 -08:00
Danila Fedorin 8c8e84b10d Fix bug causing spaces and newlines to remain in source. 2018-02-20 16:37:37 -08:00
Danila Fedorin a7c49192fb Use the new utility functions. 2018-02-20 13:24:21 -08:00
Danila Fedorin f8d07350a7 Implement functions to help with allocation. 2018-02-20 13:11:40 -08:00
Danila Fedorin 8ffcbb0ee2 Make blocks expressions, and add implicit void expression at block ends. 2018-02-18 21:05:06 -08:00
Danila Fedorin 987027c4fc Revert "Allow last expression in code to not be terminated by a semicolon."
12660b1e4a
2018-02-18 20:05:15 -08:00
Danila Fedorin 96b2dc234f Remove currently unused node types from the tree code. 2018-02-18 19:42:54 -08:00
Danila Fedorin 12660b1e4a Allow last expression in code to not be terminated by a semicolon. 2018-02-18 19:02:06 -08:00
Danila Fedorin c7aa521b19 Change function name a little. 2018-02-17 21:33:33 -08:00
Danila Fedorin 71f7711f92 Add sanitization of operators. 2018-02-17 20:31:30 -08:00
Danila Fedorin 2e89a338df Rearrange parsing code for clarity. 2018-02-17 20:16:50 -08:00
Danila Fedorin 7cee06131e Free table entries when the table is released. 2018-02-17 19:56:18 -08:00
Danila Fedorin 07284d1fb2 Add a table entry free function. 2018-02-17 19:53:33 -08:00
Danila Fedorin 72d60855c2 Implement storing expressions into block. 2018-02-17 19:52:40 -08:00
Danila Fedorin 811704be25 Add a recursive tree freeing function. 2018-02-17 19:20:10 -08:00
Danila Fedorin a52735f0b3 Finish the "construct tree" part of Shunting Yard. 2018-02-17 19:08:35 -08:00
Danila Fedorin 68b4fb5807 Complete the "rearrange" part of Shunting Yard in the parser. 2018-02-17 16:01:21 -08:00
Danila Fedorin b1aa2a4bf5 Implement associativity storage for operators. 2018-02-17 16:00:39 -08:00
Danila Fedorin bf3c90bed2 Begin the shunting-yard implementation. 2018-02-17 14:40:43 -08:00
Danila Fedorin 101847e70d Implement function to pop things off the stack until parenth. 2018-02-17 14:40:30 -08:00
Danila Fedorin 1157b126ca Add function to create a new op node and push it to a list. 2018-02-17 14:04:59 -08:00
Danila Fedorin aef84d0548 Remove now-gone tokens from the parser. 2018-02-17 14:02:10 -08:00
Danila Fedorin 8cd1d23120 Add functions to separately register different types of operators. 2018-02-17 14:01:48 -08:00
Danila Fedorin a3ce8fbd9c Tone down the current token list, in favor of adding them later. 2018-02-17 13:32:55 -08:00
Danila Fedorin 841c2f15e5 Add function to free tree nodes. 2018-02-17 12:55:50 -08:00
Danila Fedorin ab683cbd7a Add function to construct an operator tree node from a token. 2018-02-15 23:12:47 -08:00
Danila Fedorin e11f56ee68 Add utility function to check if token is an operator. 2018-02-15 23:11:25 -08:00
Danila Fedorin ee19f55058 Implement convenience functions for looking up the implemented entries. 2018-02-11 23:00:07 -08:00
Danila Fedorin 8b13b9a735 Implement functions to register operators and functions into libabacus. 2018-02-11 22:50:44 -08:00
Danila Fedorin 72be209f0f Implement two entry types and a function to store entries in table. 2018-02-11 22:50:08 -08:00
Danila Fedorin 74034c7b76 Rename header files. 2018-02-11 22:32:42 -08:00
Danila Fedorin f67b98d7a6 Add a parser struct. 2018-02-11 22:26:19 -08:00
Danila Fedorin 37a6f31b5f Start the overarching library code, and move result enum elsewhere. 2018-02-11 22:11:33 -08:00
Danila Fedorin e5351c17a2 Fix code to stick to proper naming convention. 2018-02-11 21:22:01 -08:00
Danila Fedorin 732ff47f44 Add function to extract strings from tokens. 2018-02-11 13:42:05 -08:00
Danila Fedorin 31329a13a6 Add initial code for statement parsing. 2018-02-10 23:06:47 -08:00
Danila Fedorin 0958ecd1eb Begin working on an initial implementation for the parser. 2018-02-10 22:40:34 -08:00
Danila Fedorin 6d836a5513 Add parser state code and skeleton for the parsing procedure. 2018-02-10 22:22:51 -08:00
Danila Fedorin 1a6a80d26b Add the search feature. 2018-02-10 17:57:24 -08:00
Danila Fedorin a27bdc37f5 Begin working on a table struct to hold information during runtime. 2018-02-10 17:53:07 -08:00
Danila Fedorin 3254f5741f Add cast to libab_result in ll_foreach call. 2018-02-10 17:21:45 -08:00
Danila Fedorin d79d001013 Make sure matches come with correct types. 2018-02-10 17:21:32 -08:00
Danila Fedorin 0e4d82ad44 Fix bad expression for numbers. 2018-02-10 17:21:16 -08:00
Danila Fedorin 0ff71a9389 Implement lexing code. 2018-02-10 17:13:59 -08:00
Danila Fedorin 065f2fa4b9 Use the new error code conversion code. 2018-02-10 16:02:22 -08:00
Danila Fedorin b46dccb70d Add a utility header to convert error codes. 2018-02-10 16:01:08 -08:00
Danila Fedorin 2db840288d Implement the initialization and freeing of lexer. 2018-02-10 14:21:04 -08:00
Danila Fedorin 10652048ab Begin working on the lexer. 2018-02-10 13:57:16 -08:00
Danila Fedorin 2b0e0dd7d4 Create main source file. 2018-02-03 23:49:52 -08:00