Commit Graph

70 Commits

Author SHA1 Message Date
Danila Fedorin b311c854ee Fix segmentation fault on function parsing error. 2018-09-12 14:32:28 -07:00
Danila Fedorin 8c9acafc93 Fix bug in shunting yard implementation. 2018-08-17 19:10:48 -07:00
Danila Fedorin 3c0648e473 Fix the assumption that the stack only has infix operators. 2018-08-10 17:20:14 -07:00
Danila Fedorin 3b79b5751a Add true and false keywords to the parser. 2018-08-10 16:06:30 -07:00
Danila Fedorin 4540559097 Roll back incorrect bugfix. 2018-06-21 19:22:29 -07:00
Danila Fedorin 39dd07b134 Add pseudo-refcounting to tree creation. 2018-06-12 23:34:18 -07:00
Danila Fedorin dc9702df4c Fix memory allocation / free bugs. 2018-06-12 02:09:51 -07:00
Danila Fedorin c3a7657c71 Format code. 2018-05-17 14:53:48 -07:00
Danila Fedorin c3f413d087 Fix bug in parser causing additional frees. 2018-05-14 17:46:11 -07:00
Danila Fedorin 3e8c814215 Remove pointless parameter copying. 2018-05-11 20:36:27 -07:00
Danila Fedorin a86938b574 Use reference counted table in libab. 2018-04-24 11:35:16 -07:00
Danila Fedorin 43a22d7492 Ensure reference is always initialized. 2018-04-22 21:24:43 -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 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 0cfc1df02c Add placeholder types. 2018-04-07 14:50:06 -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 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 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 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 2823b0b66b Fix bug in order of operations processing. 2018-02-26 13:51:37 -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 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