Commit Graph

42 Commits

Author SHA1 Message Date
10f149f359 Add "def" syntax sugar for named function definitions.
This is technically redundant but it makes functional/procedural code
look a *lot* more natural.
2015-12-01 08:05:46 -08:00
c3e2f17758 Allow infix () and {} to call "call" on the left-hand side.
- Allow this for both argument lists and block arguments.

- Tweak precedence to make "." higher than infix "{}" to avoid a
  class body being parsed as the superclass clause's block argument.

- Convert all uses of ".call" to use this. (There was not a single
  case in the repo that ran into the getter ambiguity.)
2015-12-01 07:49:04 -08:00
9df6aa2f8a Remove support for implicit self sends and convert everything to '@'.
This fixes the nasty case where "foo(bar)" is context-sensitive, and
generally simplifies the compiler a lot since there is a clear
distinction between lexical and dynamic scope.

Also:

- Remove the special handling of capitalized names since all names are
  lexical now.
- Allow methods to close over local variables in enclosing functions.
- Allow implicit definition of all lexical names.
2015-11-30 22:46:11 -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