I've downloaded V8 (the javascript compiler). I was planning to try it out as a MiniPerl6 backend, but I started to play with the parser instead:
--- src/scanner.cc (revision 2877)
+++ src/scanner.cc (working copy)
@@ -858,6 +858,12 @@
bool has_escapes = false;
StartLiteral();
+
+ if (c0_ == '$') {
+ AddChar(c0_);
+ Advance();
+ }
Now I can use perl style var names:
$ ./shell
V8 version 1.3.10
> $my_var = "hello, World!"; print($my_var);
hello, World!
*update* - I've changed a few more things, and I've got some timings:
$ time ./shell -e ' my $x = 0; for (my $i=1; $i < 10000000; $i++) { $x++ }; print($x);'
9999999
real 0m0.164s
user 0m0.152s
sys 0m0.008s
$ time perl -e ' my $x = 0; for (my $i=1; $i < 10000000; $i++) { $x++ }; print($x);'
9999999
real 0m1.123s
user 0m1.091s
sys 0m0.008s
A $
as the first character in a variable name is legal anyway in Javascript…