GSoC progress repor
Paweł Murias
pawelmurias at gmail.com
Tue Aug 20 20:43:00 UTC 2013
All tests in nqp/t/nqp with the exception of test 49 are passing.
Test 49 among other things requires compiling regexes at runtime.
Example: my $regex := "a+";"aaaaa" ~~ /<$regex>/;
This is easy to do after bootstraping (when we have the whole compiler
avaliable at runtime) or a bunch of crafty hacks.
After attempting to quick hack a workaround (which would involve
starting up a new parrot process to cross compile a regex) it turned
out our current cross compiling solution won't work. I decided to
avoid waisting time on that and leave it to after the boostrap.
t/nqp directory in the nqp repository contains all the tests for the
NQP language features.
There are also tests in t/qregex which are really a whole bunch of
regex and their expected results on a suplied string.
(in a tab separated format + a harness).
And 3 tests in t/serialization which would involve a boring
translation of serialization code from a different backend.
What seems to be a good direction is to get all the tests qast tests
(which were written by Jonathan while porting nqp to the jvm) under
JavaScript. They test the backend without requiring a parser. Doing
that has uncovered a number of bugs in nqp-js. Major things like multi
methods seem to work correctly but I have encoutered many small bugs.
Which seems to imply that the nqp test suit needs to be more
exaustive.
A few examples of those and their fixes:
nqp::null() was tested for truthfullness is some places, we are
currently doing that using a .Bool method so I had instead of using a
native javascript null switch to using a custom singleton for
that.https://github.com/pmurias/rakudo-js/commit/896e597f1358a3a51d64a955eb4d013dc4fe2d27
Objects being false by default caused if $slurp {...emit some code for
slurp...} not to
workhttps://github.com/pmurias/rakudo-js/commit/580829d2ea337c57fad19273d232ccfb15b9baa4
\n not being implemented in regexes caused subst(/\n/,"\\n",:global)
to loop infinitly:https://github.com/pmurias/rakudo-js/commit/868b4bdd36cca93287b21e18ebf9ebcb1885d344
Currently in nqp-js I'm using JavaScript arrays as nqp arrays (with a
bunch of methods monkey patched on top of them).
That caused a problem as JavaScript alread has a push and unshift
methods (hinting that it was somewhat inspired by Perl 5).
The tests thus far where using the nqp::push op for adding elements to arrays.
However QAST::Compiler::JavaScript uses the .push method
Example: nqp::push(@foo,$value) vs @foo.push($value).
My current calling convention is that $foo.bar(:a("named"),1) is
translated to $foo.bar(ctx,{"a":"named"},1).
Which ended up in strange things being added into arrays (Which
resulted in some fun debugging).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20130820/1c680202/attachment.html>
More information about the parrot-dev
mailing list