[Grace-core] Minigrace in the browser

Michael Homer mwh at ecs.vuw.ac.nz
Fri Jul 1 16:02:26 PDT 2011


On Jul 1, 2011 8:06 PM, "Andrew P. Black" <black at cs.pdx.edu> wrote:
>
> Michael,
>
> This is a really fantastic tool for trying stuff out as we develop the grace design!  Well done!
>
> The most useful thing to me would be useful diagnostics when I type a non-grace program.  SInce I don't know what's in mini-Grace, and the compiler seems to produce _some_ code for any input, even if it's not legal, it's a bit hard to figureo ut where the bugs (in my input) are.

Right, the runtime errors from JavaScript aren't much good (the
compile-time ones are the same as the native compiler, but those only
catch syntax errors, and not all of those). The translation loses most
of the call-stack information at the moment. I've just committed a
change that should give at least a line number for runtime errors, so
that should help a little. I will make it track the call stack
explicitly, and once the type system is in there static errors should
appear too.

The best way to get an idea of what's supported is to look through the
test cases - those cover most of the basic functionalities of the
intersection of the languages. There is no real Unicode support
though, since including the character database is implausible.

Some other things that are supported and might be useful for
experimentation, but unspecified:
- List literals between []. Lists support .at and postcircumfix []
indexing, .push, .pop, assignment, and .contains.
- Some methods on String: substringFrom()to, replace()with, ord

And other notes on non-obvious restrictions:
- Nullary method requests do not require parentheses, but all others
do unless the argument is a block. Declarations always do.
- Multi-part method names cannot currently take more than one argument
in any one position, and each word must start on the same line as the
last argument ended.
- There is no explicit lexical resolution of variable or method names
- scoping is currently deferred to JavaScript, and receiverless
methods are invoked on self.
- The builtin types are String, Number, Boolean, Block, and List.
Numbers are internally doubles and support all the basic arithmetic
operations; Strings have the methods mentioned and .at/[]/++. Booleans
support &, |, and .not, but no short-circuiting operators. Blocks only
have an apply() method.

> How can we migrate this towards actually supporting Grace, rather than mini-Grace?

You need to specify the rest of it! Everything implemented in the
compiler will show up in this one. It will probably never have full
Unicode support, but other than that all of the language should be
there eventually as my implementation converges on the specification.
The test cases in there are meant to be for Grace-as-specified, so
more of those for other situations will help too.
-Michael


More information about the Grace-core mailing list