Commit Graph

274 Commits

Author SHA1 Message Date
Danila Fedorin 06f17f491c Move variable setting code into utilities. 2018-09-13 23:57:33 -07:00
Danila Fedorin ca6075e8d5 Add a new method call operator, and more.
The '.' operator now represents method calls. A function f: (a, b)->c
can be called as a.f(b), which is equivalent to f(a, b). Besides
this change, all reserved operators now have a negative precedence
(it's relative, remember?), and some function names were changed.
2018-09-13 17:05:39 -07:00
Danila Fedorin 4425b27b52 Make overloading code a utility function and call from interpreter.
This fixes #10.
2018-09-13 16:09:04 -07:00
Danila Fedorin 25dd70f040 Fix segmentation fault during type initialization. 2018-09-13 15:08:57 -07:00
Danila Fedorin 5617484aff Make parsing function public.
libab already provides a _run_tree ... you can't run_tree if there's
no tree.
2018-09-12 14:43:43 -07:00
Danila Fedorin b311c854ee Fix segmentation fault on function parsing error. 2018-09-12 14:32:28 -07:00
Danila Fedorin c4a7117704 Ensure operator does not try to take ownership of string. 2018-08-22 17:45:45 -07:00
Danila Fedorin 899ac31210 Add a README. 2018-08-20 00:00:02 -07:00
Danila Fedorin 01720914e0 Fix bug in table lookups. 2018-08-18 17:30:33 -07:00
Danila Fedorin 8c9acafc93 Fix bug in shunting yard implementation. 2018-08-17 19:10:48 -07:00
Danila Fedorin 37593abe40 Fix GC bug in overloaded functions. 2018-08-14 18:51:00 -07:00
Danila Fedorin 0065fe5e65 Add utility functions to create libab instances on the heap. 2018-08-12 00:46:37 -07:00
Danila Fedorin de0ad13785 Remove function call prints from interactive. 2018-08-11 22:42:36 -07:00
Danila Fedorin 3d0e4776fc Fix bugs related to partial application types. 2018-08-11 22:26:11 -07:00
Danila Fedorin 3fc7f46680 Increment tree refcount. 2018-08-11 21:19:02 -07:00
Danila Fedorin cf57c4a29a Remove deliberate memory leak.
It was used to test the GC.
2018-08-11 20:29:08 -07:00
Danila Fedorin 59b03d0a94 Fix partial application memory leak. 2018-08-11 20:27:52 -07:00
Danila Fedorin ffcbab9d94 Remove unused files. 2018-08-11 20:11:32 -07:00
Danila Fedorin 8847643c2e Merge branch 'gc' 2018-08-11 20:09:56 -07:00
Danila Fedorin 76ea606099 Finish basic implementation of garbage collection. 2018-08-11 20:01:43 -07:00
Danila Fedorin f4ecb82c46 Intermediate commit before visitor refactor. 2018-08-11 18:22:18 -07:00
Danila Fedorin 80e7c95915 Make small adjustments to GC functions. 2018-08-11 16:00:00 -07:00
Danila Fedorin f257d0b2de Remove freed refcount from any list it's part of. 2018-08-11 01:42:30 -07:00
Danila Fedorin 9eae28928a Move GC code to separate source file. 2018-08-11 01:40:30 -07:00
Danila Fedorin ec2421e5d7 Begin working on a garbage collector. 2018-08-11 01:29:48 -07:00
Danila Fedorin 0b7b49d03d Fix memory leak caused by not freeing type. 2018-08-11 00:42:15 -07:00
Danila Fedorin 512d68000f Link math library for atan2 and atan 2018-08-11 00:41:39 -07:00
Danila Fedorin 71b6092654 Implement do ... while. 2018-08-10 20:06:02 -07:00
Danila Fedorin 20fb078ad2 Change assignment behavior to update existing table entries. 2018-08-10 19:56:46 -07:00
Danila Fedorin d7ef8e236d Add more specific lookup functions. 2018-08-10 19:47:11 -07:00
Danila Fedorin 450d12dc43 Add an equality function. 2018-08-10 19:21:55 -07:00
Danila Fedorin 0824dee594 Add a while loop. 2018-08-10 19:16:47 -07:00
Danila Fedorin 0a21c7fdf7 Add logical and and logical or operators. 2018-08-10 18:40:31 -07:00
Danila Fedorin aebba42196 Use the new public functions. 2018-08-10 18:40:21 -07:00
Danila Fedorin 4a058384c1 Make some functions public. 2018-08-10 18:39:26 -07:00
Danila Fedorin b0c2eb5a5e Maintain the promise that references are null-ed on error. 2018-08-10 17:31:02 -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 8192d767f2 Add macro for declaring functions. 2018-08-10 16:59:44 -07:00
Danila Fedorin 416686ca72 Add boolean logic functions and operators. 2018-08-10 16:54:53 -07:00
Danila Fedorin fdca2a8ca7 Add more sanitizing characters. 2018-08-10 16:54:39 -07:00
Danila Fedorin d0615d2c3e Implement the if statement. 2018-08-10 16:34:28 -07:00
Danila Fedorin b1ab168907 Do not exit on absence of print function. 2018-08-10 16:15:58 -07:00
Danila Fedorin 3b79b5751a Add true and false keywords to the parser. 2018-08-10 16:06:30 -07:00
Danila Fedorin 7c8c547540 Add true / false values to interpreter. 2018-08-10 15:29:56 -07:00
Danila Fedorin 25f5d3469b Add a boolean type. 2018-08-10 00:52:12 -07:00
Danila Fedorin 6b331cc3c4 Report error code from function call. 2018-06-22 00:44:59 -07:00
Danila Fedorin 4540559097 Roll back incorrect bugfix. 2018-06-21 19:22:29 -07:00
Danila Fedorin 48300cd86e Implement reserved operators. 2018-06-21 19:00:45 -07:00
Danila Fedorin a5429ae2c8 Maintain scope between lines executed. 2018-06-21 17:23:34 -07:00
Danila Fedorin 03577269f2 Add various ways to call code. 2018-06-21 17:06:53 -07:00