Guesses whether the input is an expression or statement and handles it
appropriately. Finally, after over a year, the Wren REPL automatically
prints "3" if you type in "1 + 2". \o/
It doesn't actually execute code yet, but it:
- Supports left and right arrow keys for moving the cursor.
- Ctrl-C, Ctrl-D, Ctrl-A, and Ctrl-E for navigating.
- Syntax highlights the line (!).
The next step is to do a rough parse so that we can tell if the line
is an expression, statement, or needs more input. That will tell us
whether we need to interpret it at the top level (statement) and not
worry about a result, evaluate it as an expression and print the result,
or read more lines.
There's nothing new in this "release", but now is as good a time as any
to start versioning. Going forward, I plan to do periodic releases and
update the changelog so users can see what's going on.
This PR adds support for retrieving list information from a slot. Rather
than take the whole list, two different methods are provided for
retrieving a) the length of the list, and b) a specific value in the
list.
- Break embedding out into a separate section with multiple pages.
- Document the constraints on the API.
- Document the slot array and WrenValue.
Still lots more to do, but getting there...
This has a couple of pros:
- It simplifies some code that used to have to check whether a called
thing is a bare function or a closure.
- It's faster because we don't need to do the above checks every time
something is called.
- It lets us more precisely type some fields that used to be Obj*
because they could hold an ObjClosure* or ObjFn*.
The cost is that we allocate a closure every time a function is
declared, even if it has no upvalues. Since functions are called way
more often than they are declared, this is still a net win.
On my Mac laptop:
api_call - wren 0.06s 0.0020 104.73%
api_foreign_method - wren 0.32s 0.0040 101.89%
binary_trees - wren 0.23s 0.0057 98.82%
binary_trees_gc - wren 0.79s 0.0170 98.46%
delta_blue - wren 0.13s 0.0031 101.36%
fib - wren 0.23s 0.0038 103.15%
fibers - wren 0.04s 0.0017 98.97%
for - wren 0.08s 0.0017 107.81%
method_call - wren 0.12s 0.0024 98.60%
map_numeric - wren 0.31s 0.0052 103.93%
map_string - wren 0.11s 0.0113 97.97%
string_equals - wren 0.20s 0.0023 107.75%
commit f93ec6430f9629b5a28765a3961379d1e8296e50
Author: Bob Nystrom <robert@stuffwithstuff.com>
Date: Wed Mar 16 08:03:25 2016 -0700
Tiny tweaks.
commit 332a08fe33cddffec82dbd377ee0c941a0066f64
Merge: a67398114b7a08
Author: Bob Nystrom <robert@stuffwithstuff.com>
Date: Wed Mar 16 08:01:00 2016 -0700
Merge branch 'errorFn' of https://github.com/ppvk/wren into ppvk-errorFn
commit 14b7a086ce
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:33:37 2016 -0500
missing semicolon, accessing vm through parser in
commit 924eaa1f9d
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:25:32 2016 -0500
fixed missing errorFn in wren.h
commit 3761df111f
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:23:51 2016 -0500
Added an errorFn to the CLI
commit d51137b4ab
Author: Paul VanKeuren <paul.vankeuren@gmail.com>
Date: Tue Mar 15 11:21:16 2016 -0500
Added a WrenErrorFn typedef, an errorFn slot in WrenConfiguration. exits early if is not defined, otherwise it runs the errorFn .