Commit Graph

58 Commits

Author SHA1 Message Date
Bob Nystrom
42b04c6c90 Fix bug in loops.
It was still popping the stack for the body even though loop
bodies are statements now.
2013-12-07 18:47:40 -08:00
Bob Nystrom
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
Bob Nystrom
e4043d69b4 Unify code for ending compiler.
There's now a single code path for the end of a chunk of bytecode, so
we can eventually put code there for capturing closures.
2013-12-01 14:59:56 -08:00
Bob Nystrom
19811143a0 Always use provided allocator for allocation. 2013-12-01 10:22:32 -08:00
Bob Nystrom
8c9ce024ee Move debug code into separate module. 2013-11-29 16:17:33 -08:00
Bob Nystrom
325bb281a5 Allow 16 arguments, and handle going over that correctly. 2013-11-29 15:08:27 -08:00
Bob Nystrom
1b353e9380 Make pinned list a linked list instead of hardcoded array. 2013-11-29 09:18:13 -08:00
Bob Nystrom
715fecdc7c Rename files and add some docs. 2013-11-28 08:11:50 -08:00