Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
283 lines (189 sloc) 7.8 KB
TODO list for Perlito5
* perlito5 command-line
* libraries
-- these should probably go into namespace Perlito5X::*
-- Test (implemented as Perlito5::Test)
-- Data::Dumper (implemented as Perlito5::Dumper)
-- create perlito5-specific libs for:
feature.pm
Config.pm
overload.pm
bytes.pm
integer.pm
constant.pm
lib.pm
Carp.pm
vars.pm
Tie::Array
Tie::Hash
Tie::Scalar
alternately, check $^H for strictness - such that perl's own strict.pm just works
and ${^WARNING_BITS} for warnings
* Parser
-- defined-or vs. m// (2012/9/25 Конрад Боровски <notifications@github.com>)
Note: fixed; see test t5/01-perlito/25-syntax-defined-or.t
$ perl perlito5.pl -Isrc5/lib -Cast-perl5 -e ' shift // 2 '
Number or Bareword found where operator expected
$ perl perlito5.pl -Isrc5/lib -Cast-perl5 -e ' shift / 2 '
Can't find string terminator '/' anywhere before EOF
-- quotes vs. hash lookups:
$ perl -e ' q}} '
# ok
$ perl -e ' $x{ q}} } '
Unmatched right curly bracket at -e line 1, at end of line
$ perl -e ' $x{ q]] } '
# ok
-- attributes - see: http://perldoc.perl.org/attributes.html
-- create __DATA__
-- "sub _" should be in package "main"
$ perl -MO=Deparse -e ' package X; sub _ { 123 } '
package X;
sub main::_ {
123;
}
-- "given" statement not implemented
-- "default" statement not implemented
-- clean up:
the several "end_tables" in Expression.pm are duplicating the function of
$Precedence in Precedence.pm - Expression.pm should use $Precedence directly.
-- fix the prototype for 'stat(*)' (see t/test.pl in the perl test suite)
-- compile-time eval() is not bound to the "program" environment, but to the "compiler" environment instead
my $v;
BEGIN { $v = "123" }
use Module $v; # $v is not accessible at compile-time
-- parse the regexes
-- create an AST for regexes
-- prototypes (signatures)
--- done: "empty" _ $ ;$
--- check that undeclared barewords give the right error
--- *foo = sub () { ... } # does prototype work here?
--- check signature in sort()
-- check that \(@a) and \@a have different meanings
-- $v{x::y} autoquotes the index when x::y() exists
-- $v->{x} doesn't interpolate inside double quotes
-- deref inside double quotes:
$ node perlito5.js -Bjs -e ' my $x = "123"; my $y = \$x; print "[$$y]\n" '
[$[object Object]]
$ node perlito5.js -MO=Deparse -e ' " $v->{x} $$v{x} " '
(' ' . $v . '->{x} $' . $v{'x'} . ' ');
-- add "print", "printf", "say" special parsing - note this is related to indirect object notation
-- indirect object notation
http://lwn.net/Articles/451486/
http://www.modernperlbooks.com/mt/2009/08/the-problems-with-indirect-object-notation.html
http://shadow.cat/blog/matt-s-trout/indirect-but-still-fatal/
http://perlbuzz.com/mechanix/2008/02/the-perils-of-perl-5s-indirect.html
method Module $param;
new Class( arg => $value );
new Class::($args);
say $config->{output} "This is a diagnostic message!"; # indirect call
say {$config->{output}} "This is a diagnostic message!"; # say to filehandle
use Class;
sub Class {
warn 'Called Class sub not Class package';
'Class'
}
my $q = Class->new; # calls the Class sub above
my $s = new Class; # throws a 'Bareword found where operator expected' error
my $t = Class::->new # this works
my $u = new Class::; # this also works (even with sub main in the current package)
-- lookup for existing subroutines:
sub m { my @x = 8, 9; @x } $x = m(); # m() is not a "match"
-- add tests for fixed bugs:
filetest operators special case:
' -f($file).".bak" ' should be equivalent to -f "$file.bak"
parses as -(f($file)).".bak"
but: ' -f ($file).".bak" '
parses correctly
This seems to be because there is a rule that \w followed by '(' is a function call;
this needs more testing: ' ... and(2) '
Test: redefine 'and', 'not' and check what works.
' $s111++ + $s222 '
parses as (+$s222)++
' $step++ < $steps '
Can't find string terminator '>' anywhere before EOF
* Perl5 backend
-- ${^NAME} needs curly-escaping
- fix regex delimiters, or escape the regexes
-- continue block in block: ' { print 1 } continue { print 2 } '
-- emitter bug: significant parenthesis:
t5/01-perlito/12-context.t fails because:
" return (4, 5) " instead of " return 4, 5 "
-- bug: ' $$x [$y] '
emits as ${$x}->[$y];
* Javascript backend
-- "or" has SCALAR context (Abigail++):
See: t5/01-perlito/23-eval.t
-- "~~" operator not implemented; See also "when" implementation
-- "when" should use a "break" exception inside "given", and a "next" exception inside "for".
-- "given" statement not implemented
-- "default" statement not implemented
-- bug: some declarations are not "seen":
for ( my $i = 0; $i < 10 ; $i++ ) { print "$i\n" } # compiles to global $i
-- bug: don't emit throw() in term position; javascript requires a function() wrapper because throw() is a statement
-- javascript errors don't show in the global error handler when running in node.js
-- "autoload" the compiler if eval-string is used (eval-string needs the compiler at run-time)
-- symbol variables like $] ${"main::\$"} $#_
-- check that @_, $_, $a, $b and other special variables are in the right context (lexical, global, package global)
-- emit array/hash slices: @a[@x], @a{@x}
-- add alternate mro's
-- cache the mro
-- add regex compiler
-- /e modifier
-- /x modifier
-- support all perl5 regex syntax
-- @v = /x/g
-- bug: variable redeclaration does not work
-- javascript "var" erases the outer value within the whole current lexical scope
-- bug: "my" variables - this doesn't work as expected: my $v = $v
possible fix: rename variables
-- lvalue ternary: ($a_or_b ? $a : $b) = $c;
-- lvalue substr()
-- 4-arguments substr()
-- pos($str)
-- lvalue chomp(), chop()
-- missing some types of subroutine signatures
-- bug: variable aliases create copies instead
-- generate more compact code; maybe use more subroutines instead of inlining;
autovivification is probably the most verbose part of the code.
-- in the browser: implement "use" with XMLHttpRequest (what are the security implications?)
-- add symbol tables for scalar, array and hash
-- references to typeglobs:
$ perl -e ' print ref(\*main) '
GLOB
-- aliasing between lexicals and globals
$ perl -e 'use strict; my $x = 3; *main::z = \$x; print $main::z; '
3
-- string increment and string ranges
See: p5str_inc()
-- finish "overload" implementation
-- pack(), unpack()
-- y()()
-- BEGIN{} should execute in the environment of the program under compilation
-- BEGIN/END that are defined inside blocks/closures need to run inside some pseudo-environment
even if the closure was never created or used in the first place
-- AUTOLOAD
AUTOLOAD is implemented for method lookups, but not for normal subroutines
* Nice to Have
-- debugging symbols
-- line numbers in error messages
-- caller()
-- "when"
-- run more of the "perl" test suite
-- proper "use strict" and "use warnings"
-- use the same error messages and warnings as 'perl'
-- no warnings 'redefine';
-- __LINE__, __FILE__
-- INIT{}, END{}
look at the implementation in perlito6-in-Go
-- source code - remove Perl 6 code such as "token"
(fixed: This is only loaded if the grammar compiler is needed)
-- *{ $name }{CODE}->();
-- local(*{$caller."::a"}) = \my $a;
-- *{$pkg . "::foo"} = \&bar;
* Deprecate
-- remove unused features from src5/lib/Perlito5/Grammar/Regex.pm
-- Interpreter backend
this is not being maintained; the code is still in src5/lib/Perlito5/Eval.pm just in case
-- Perl6 backend (started)
this is not being maintained; not sure if compiling to Perl6 is the best way
maybe compiling directly to Parrot/dotnet/Haskell gives better results
Jump to Line
Something went wrong with that request. Please try again.