Commit Graph

50 Commits

Author SHA1 Message Date
157944aa27 Get closures working!
In the process, I had to change the grammar. There is now a strong
separation between statements and expressions. The code was just wrong
before when it popped locals at the end of a block scope because there
could be temporaries on the stack if the block was in expression
position. This fixes that.

Still need to implement closing over `this`.
2013-12-04 07:43:50 -08:00
60c97b5c2f Make sure we don't go over the maximum number of locals. 2013-11-30 18:51:27 -08:00
88852960ca Handle local variable shadowing. 2013-11-30 18:28:01 -08:00
b390bdf604 Clean up constructor tests. 2013-11-29 15:21:36 -08:00
325bb281a5 Allow 16 arguments, and handle going over that correctly. 2013-11-29 15:08:27 -08:00
5f1d5cfa85 Do not allow fields outside of classes. 2013-11-29 10:53:56 -08:00
1bfa252a70 List.removeAt(). 2013-11-27 10:20:32 -08:00
f8ded27376 List.clear and List.insert(). 2013-11-26 23:11:11 -08:00
56449cdbef Reorganize tests. 2013-11-26 22:52:00 -08:00
897a396599 List.add() method. 2013-11-26 18:02:10 -08:00
eaeec01dc6 Get inheritance and core classes more correctly wired up. 2013-11-26 07:52:37 -08:00
c99f4d7834 Subscript operator for lists. 2013-11-24 19:08:46 -08:00
7a343f2ecf List literals. 2013-11-24 13:38:31 -08:00
f9b008e283 Subscript operators! 2013-11-24 10:45:07 -08:00
e3e1f7f3d4 Start working on string escapes. 2013-11-23 21:00:47 -08:00
a5bbe81280 Start to get instance fields working. 2013-11-23 14:55:05 -08:00
3b0e962a05 Named, user-defined constructors. 2013-11-20 07:20:16 -08:00
fe48113054 Logical "||" operator. 2013-11-19 18:24:58 -08:00
6b87a8400f "&&" operator. 2013-11-19 07:35:25 -08:00
e614e092ed Start getting block scope working. 2013-11-18 09:19:03 -08:00
4d23d58bf1 While statements. 2013-11-17 22:38:59 -08:00
0c1ce91e80 Make String#contains return a bool. 2013-11-17 10:04:02 -08:00
cfb5193ce8 Function parameters. 2013-11-14 18:25:28 -08:00
167e174480 User-defined operators. 2013-11-14 10:59:28 -08:00
85d9bffa08 Block comments. 2013-11-13 17:09:47 -08:00
27a652e565 Start sketching out inheritance. 2013-11-13 11:05:03 -08:00
9d4599f6e6 Unary operators and variable assignment. 2013-11-13 07:10:52 -08:00
915ecb4e58 Static methods. 2013-11-10 11:46:13 -08:00
f19dd64f8b Floating point number literals. 2013-11-09 21:32:57 -08:00
3cdabcb8c7 "%" operator for numbers. 2013-11-09 21:01:18 -08:00
a1f10786ef "this" expressions. 2013-11-09 15:42:23 -08:00
0cc5524249 Generate correct code for locals. 2013-11-09 11:38:01 -08:00
a2f0e41bcb Method parameters. 2013-11-09 11:18:27 -08:00
166d74930f "is" operator. 2013-11-07 17:07:32 -08:00
55e433f980 Reorganize the compiler to be bottom-up.
Gets rid of a bunch of forward declarations and shortens the code.
Also makes points of recursion more explicit.
2013-11-07 07:04:25 -08:00
8f6881c6a8 Change syntax for blocks -> fns. 2013-11-06 07:47:47 -08:00
4ff444b1ab Unskip some working tests. 2013-11-05 20:38:16 -08:00
2e6888364d "null" literal. 2013-11-05 18:22:22 -08:00
3db228eecf Start hacking on "if" expressions. 2013-11-05 15:40:21 -08:00
67356df1f9 "==" and "!=" operators. 2013-11-05 09:57:57 -08:00
6000177126 Clean up block and method calling. 2013-11-05 07:56:59 -08:00
dff19bd8c3 Booleans and comparison operators on numbers. 2013-11-03 21:38:58 -08:00
1741bb2693 ".toString" on num and string. 2013-11-01 23:27:28 -07:00
cfa65a6536 Don't require a newline at the end of a file. 2013-11-01 06:57:21 -07:00
46c0fe87e6 Parentheses for grouping. 2013-10-31 21:49:15 -07:00
64f1b39ee9 Get infix arithmetic operators working. 2013-10-31 07:04:44 -07:00
9208a7f862 Start testing errors.
- Add support to test runner for compile errors.
- Include line number in tokens.
- Exit with non-zero on compile error.
2013-10-28 07:12:39 -07:00
db14c531b8 More tests for primitives. 2013-10-28 06:53:51 -07:00
f5d9908346 String literal tests. 2013-10-28 06:45:19 -07:00
95fb0863d9 Add IO class.
With io.write(), can start writing tests now.
2013-10-27 22:45:40 -07:00