Commit Graph

1322 Commits

Author SHA1 Message Date
a3505fa060 Simplify runtime error reporting. 2016-03-03 17:11:52 -08:00
9fda7cb526 Unify Fiber.try() with the other methods to execute fibers. 2016-03-03 17:00:33 -08:00
d717ddf817 Simplify how assignment expressions are compiled. 2016-03-03 16:30:48 -08:00
84bcb5801c Add a test for creating a VM without a config. 2016-03-03 14:31:47 -08:00
41e30f47d8 wrenNewVM NULL check
My first attempt to embed VM in project ended with crash. Fortunately I'm not so easly scared and managed to found out that despite comment in "wren.h" no check for null is performed. I took the liberty of fixing that. 
Btw. nice project, keep up the good work!
2016-03-03 17:58:50 +01:00
223d66a01c I can spell gooder. 2016-02-27 16:23:48 -08:00
0a83697bd4 Minor janitorial work. 2016-02-27 16:05:50 -08:00
1e4b9e5175 File.realPath().
Not tested yet, because we can't create symlinks from Wren and I don't
want to check symlinks into the repo, but it seems to do the right
thing.
2016-02-27 15:53:02 -08:00
e6b48de598 Fix precedence table in docs.
It was out of sync with the actual implemented precedence in a few
places.
2016-02-27 10:14:09 -08:00
fa2598c601 Upgrade to libuv 1.8.0. 2016-02-27 09:19:56 -08:00
b7e189fe11 Desugar import statements to core library calls.
This is simpler than having special opcodes for them. It's also a bit
faster, and gets some non-critical code out of the interpreter loop.

Also, this is good prep work for being able to write some of the module
loading process in Wren to make things more flexible for embedders and
the CLI.
2016-02-26 22:43:54 -08:00
edca85827a Combine block() and statement().
The separation between the two didn't really do anything useful.
2016-02-25 07:04:48 -08:00
d46dfc9500 Allow "*" on lists and strings to repeat them.
This is not implemented on Sequence because, at least for lists and
strings, I think users expect an eager result. Multiplying a string
should give you back a string, not a lazy sequence of repeated
characters.

This also mirrors "+" on strings and lists, which is eager. I like the
idea of having a general guideline that operators are eager.

Repetition is useful for arbitrary sequences, but for that maybe we
should add a "repeat()" method.
2016-02-24 07:48:03 -08:00
919605b7ba Couple of tiny tweaks. 2016-02-24 06:52:12 -08:00
2c4e497c54 Fix a couple of doc bugs. 2016-02-22 07:48:53 -08:00
60162575ee More file system checking functions:
- Stat#isFile
- Stat#isDirectory
- Directory.exists()
- File.exists()
2016-02-21 12:23:33 -08:00
c6148f8941 Make Stat a foreign class.
Instead of copying the uv_fs_stat struct to a list of Wren numbers, we
store it directly in the Stat object. This is important because we'll
need to implement later methods like isDirectory() in C so we can use
S_ISDIR(). For that, we need to have access to the original stat data.
2016-02-21 11:34:10 -08:00
b331915259 Add stat instance method to File. 2016-02-21 10:18:45 -08:00
3101d9c499 Fix file flags to be OS-independent. 2016-02-20 17:25:41 -08:00
ff96a179ac Include stdio.h when debugging is enabled. 2016-02-20 13:36:22 -08:00
8e90e3577b More file IO!
Can now create, delete, and write to files.
2016-02-20 09:23:42 -08:00
bec5181bdb Add separate targets for building just the shared or static library.
make static
make shared

Running "make vm" will build both, as usual.

Fixes #322.
2016-02-19 07:22:10 -08:00
ef3aa07d84 Add API to get the type of object in a slot. 2016-02-19 07:18:00 -08:00
fa0a507b48 Error on jump distance overflow. 2016-02-19 06:57:38 -08:00
5b7cd12e76 Don't run the skynet example from the tests.
It's too slow on the Travis bots and times out.
2016-02-14 22:28:14 -08:00
b8e85c83a8 Fix test and add skynet example. 2016-02-14 22:21:50 -08:00
d823896136 Merge branch 'master' of https://github.com/munificent/wren 2016-02-14 22:18:53 -08:00
1a6d3703d2 Merge pull request #320 from 4d47/small-doc-update
Fix two small code samples in doc
2016-02-12 10:35:40 -08:00
edbffc9a95 Simplify method() and defineMethod().
Passing along a Variable lets us get rid of some duplicate code around
loading the class.
2016-02-12 07:43:44 -08:00
68f801a525 Unnecessary strncmp -> memcmp. 2016-02-12 07:27:42 -08:00
5b5c258f55 Make a little Variable struct.
Gets rid of the slightly ugly loadInstruction output parameter that
gets passed around. Now a reference to a variable is a first-class
concept in the compiler.
2016-02-12 07:16:41 -08:00
ff69b12c2c Fix sample in doc/site/error-handling
Add missing constructor.
2016-02-11 18:06:51 -05:00
a2e03279e2 Fix abs code sample in doc/site/modules/core/num
-123.abs returns -123 because the dot has higher precedence so it's
 really -(123.abs).
2016-02-11 17:58:09 -05:00
68ab4e88c0 Merge branch 'master' of https://github.com/munificent/wren 2016-02-09 07:24:55 -08:00
8b36e2f00b Add sample(_) and sample(_,_) to Random. 2016-02-09 07:24:45 -08:00
895136b78c Merge pull request #319 from 4d47/small-doc-update
Update wrenInterpret doc/site/embedding-api
2016-02-08 17:43:05 -08:00
82307232cc Update wrenInterpret doc/site/embedding-api 2016-02-08 08:34:56 -05:00
d4a4b26203 Add Random.shuffle(). 2016-02-07 10:38:39 -08:00
79558d95e5 Move File.stat() -> Stat.path().
Thanks, Michel!
2016-02-07 09:56:16 -08:00
ffb5ada9fb Move the community docs to the wiki. 2016-01-24 15:39:35 -08:00
fde6cfc142 Generate wrenAllocateForeign() to match the other setSlot methods.
Thanks, Michel!
2016-01-24 09:25:04 -08:00
71e2458a6c Add API for accessing command-line arguments.
- Add process module with Process class.
- Add "arguments" and "allArguments" methods.
- Docs for same.
- Support passing additional arguments to command line.
- Add "--help" support to command line.
2016-01-22 07:57:26 -08:00
860220869a Oops. Completely disable lto. 2016-01-22 07:01:56 -08:00
f19888d328 Merge branch 'master' of https://github.com/munificent/wren 2016-01-22 06:42:16 -08:00
7e8bc2a89a Disable link-time-optimization for now.
It's failing when building with clang on Travis. The underlying problem
seems to be something broken with how LLVM is looking for the gold
linker, and working around that is outside of my skillset.

To learn more, Google: "LLVMgold.so: error loading plugin" lto
2016-01-22 06:42:01 -08:00
056ae61493 Tweak some docs. 2016-01-21 21:38:27 -08:00
46a03e3a2d Merge pull request #318 from pra85/patch-1
Update license year range to 2016
2016-01-21 15:20:58 -08:00
39b29ee07a Enable link time optimization in the CLI.
One little compiler flag makes a surprisingly large difference:

api_call - wren            0.05s 0.0017 130.52% relative to baseline
api_foreign_method - wren  0.24s 0.0017 144.54% relative to baseline
binary_trees - wren        0.21s 0.0032 112.27% relative to baseline
binary_trees_gc - wren     0.75s 0.0288 115.02% relative to baseline
delta_blue - wren          0.13s 0.0031 103.24% relative to baseline
fib - wren                 0.20s 0.0036 120.56% relative to baseline
fibers - wren              0.04s 0.0007 108.52% relative to baseline
for - wren                 0.07s 0.0009 124.45% relative to baseline
method_call - wren         0.12s 0.0010  95.58% relative to baseline
map_numeric - wren         0.30s 0.0031 110.11% relative to baseline
map_string - wren          0.11s 0.0098 111.38% relative to baseline
string_equals - wren       0.19s 0.0064 115.49% relative to baseline
2016-01-20 07:47:00 -08:00
205661713a Update license year range to 2016 2016-01-17 23:28:25 +05:30
f9d1e9954a Make File.stat() directory test less file system sensitive. 2016-01-05 07:32:51 -08:00