1
0
forked from Mirror/wren

47 Commits

Author SHA1 Message Date
039150efeb docs; fix example formatting 2020-07-30 09:24:23 -07:00
81bfbfce23 fix issue with docs clearing the writeFn from the config. add complete embedding example to docs + repo 2020-07-30 09:09:15 -07:00
d585a080e8 Merge pull request #751 from wren-lang/0.3.0-refactor
0.3.0 refactor
2020-06-05 14:57:20 -07:00
744147fd94 Flush prompt in animals example. 2018-08-01 07:28:48 -07:00
8210452970 Relative imports!
This is a breaking change because existing imports in user Wren code
that assume the path is relative to the entrypoint file will now likely
fail.

Also, stack trace output and host API calls that take a module string
now need the resolved module string, not the short name that appears in
the import.
2018-03-24 11:10:36 -07:00
5ddd783ff5 Use strtoll() for hex literals to handle 64-bit ones even on 32-bit. 2017-01-12 21:53:21 -08:00
04a7c9b5c8 Improve Travis Build & Test Coverage
Build Wren for more targets, and run the test suite on both 32 and 64
bit builds.

 * Update the build config to test both with and without NAN_TAGGING
   defined.

 * Updatest `util/test.py` to take the executable suffix as a
   parameter. This allows the makefile to control which binaries will be
   tested.

   Adds a new target to the makefile to be run by travis, this runs the
   test suite against all of the configurations it builds.

 * Gcc on some 32 bit platforms was complaining about numeric overflows
   when -INFINITY was used. Update the logic for converting a double to
   a string to not explicitly check against the literal values.

 * Make CI builds run the tests on both 64 _and_ 32 bit builds.

 * If I limit the number of CPUs on my MBP I can get some of the tests
   to time out, I'm imagining that the specs of the Travis Macs means
   that the same is happening there too. Updated the test script to
   allow an extra few seconds for the test to complete successfully
   before killing it.

 * Due to slight differences in accuracy in some computations tests were
   failing on 32 bit builds. Stop comparing things quite as exactly in
   the cases where it is causing issues.

   For some reason 12.34 was refusing to compare equal to itself. Bad
   show 12.34 :-/. I've also updated the test so it doesn't leak handles
   even if the assertions fail.

 * Double-cast from `double` to `uint32_t` to prevent undefined
   behaviour on overflow of basic integers. This should hopefully
   prevent 32 bit test failures on Linux.

 * Move to a version of LibUV with a fix for the 32 bit build error on
   Travis.
2016-12-29 17:52:38 +00:00
b8e85c83a8 Fix test and add skynet example. 2016-02-14 22:21:50 -08:00
a38753d1d6 Add an animals guessing game example. 2015-11-29 09:43:47 -08:00
78655c68b0 Simple string interpolation.
This allows "%(...)" inside a string literal to interpolate the
stringified result of an expression.

It doesn't support custom interpolators or format strings, but we can
consider extending that later.
2015-11-11 07:55:48 -08:00
2c5926b32b Add guess a number example. 2015-10-17 11:19:25 -07:00
58e4d26648 "IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core
System class.

- Remove wren_io.c, wren_io.h, and io.wren.
- Remove the flags that disable it.
- Remove the overloads for print() with different arity. (It was an
  experiment, but I don't think it's that useful.)
- Remove IO.read(). That will reappear using libuv in the CLI at some
  point.
- Remove IO.time. Doesn't seem to have been used.
- Update all of the tests, docs, etc.

I'm sorry for all the breakage this causes, but I think "System" is a
better name for this class (it makes it natural to add things like
"System.gc()") and frees up "IO" for referring to the CLI's IO module.
2015-09-15 07:46:09 -07:00
2e83f056c1 No more default constructors.
Fixes #296.
2015-09-01 08:16:04 -07:00
71ab3ca887 Use "construct" instead of "this" to define constructors. 2015-07-21 07:24:53 -07:00
5fb6186d7d Make constructors just methods.
* Eliminate "new" reserved word.
* Allow "this" before a method definition to define a constructor.
* Only create a default constructor for classes that don't define one.
2015-07-10 09:18:22 -07:00
3196735f39 Add block arguments and operators to syntax example. 2015-06-26 22:14:32 -07:00
fc7612c843 Run examples as tests. Would have prevented #266 2015-05-20 10:10:40 -05:00
a114f34a2a Remove outdated set example. Fix #266. 2015-05-20 07:07:47 -07:00
f132f59649 Add syntax example file 2015-04-25 18:10:17 +02:00
bdb8634743 Tweak style. 2015-02-19 06:32:46 -08:00
4260a10983 add simple example for importing a module 2015-02-18 11:39:31 -05:00
c0b0920d67 Update set example to new Syntax. Replaces #30 2015-01-09 16:02:40 -06:00
fa85bb1eef Remove spaces from after method definitions 2015-01-09 15:15:34 -06:00
c2e6181b01 Newline at end of file 2015-01-09 15:15:34 -06:00
2253d9269f Fix for iterate handling null 2015-01-09 15:15:34 -06:00
a67cde69bb Update set example to use bitwise operators 2015-01-09 15:15:34 -06:00
18af6514f0 Add Set example 2015-01-09 15:15:34 -06:00
96d728cc5d Reorganize makefile and scripts. 2014-01-23 23:29:50 -08:00
9645ddcb26 Add a little ASCII art Mandelbrot example. 2014-01-07 23:04:30 -08:00
b979272305 Clean up text handling a bit:
- Rename IO.write -> IO.print.
- Make IO.write not print a newline.
- Support \u Unicode escapes in strings.
2014-01-05 12:27:12 -08:00
6c3aa85228 Make IO a static class instead of a singleton. 2013-12-21 19:25:09 -08:00
ee504435f7 Real hello world example. 2013-11-17 08:55:04 -08:00
8f6881c6a8 Change syntax for blocks -> fns. 2013-11-06 07:47:47 -08:00
64f1b39ee9 Get infix arithmetic operators working. 2013-10-31 07:04:44 -07:00
95fb0863d9 Add IO class.
With io.write(), can start writing tests now.
2013-10-27 22:45:40 -07:00
b9baf46e9a Argument lists. 2013-10-26 16:01:44 -07:00
f867bb8348 String literals and objects. 2013-10-25 20:40:24 -07:00
b7de165950 Line comments. 2013-10-25 20:07:04 -07:00
32f8c412c7 Method calls. 2013-10-24 21:32:17 -07:00
2f930f727e Make blocks callable. 2013-10-24 13:01:24 -07:00
911f586e7b Block objects.
Also clean up newline handling in parser.
2013-10-24 12:39:01 -07:00
67e5660346 Start working on class definitions. 2013-10-23 22:50:04 -07:00
40e6d2f077 Local variables. 2013-10-23 15:32:59 -07:00
3da1cbe2fa Pure recursive descent parser.
Also, start hacking on method calls.
2013-10-23 13:51:41 -07:00
b1867f054a Actually parse number literal. 2013-10-22 13:37:53 -07:00
dd8998db24 Start sketching out single-pass compiler. 2013-10-22 12:16:39 -07:00
2f6a6889f1 Initial commit. 2013-10-22 11:22:22 -07:00