Giter Site home page Giter Site logo

fglock / perlito Goto Github PK

View Code? Open in Web Editor NEW
414.0 50.0 47.0 56.64 MB

"Perlito" Perl programming language compiler

Home Page: http://fglock.github.io/Perlito/

License: Other

Shell 0.30% Perl 65.36% HTML 0.01% JavaScript 0.29% Go 0.57% Common Lisp 0.40% Python 0.48% Java 2.91% Ruby 0.07% Makefile 0.06% XS 0.01% Prolog 20.40% Raku 9.14%
perl5 perl6 perl compiler language javascript java jvm

perlito's Introduction

"Perlito5" Perl to Java compiler and Perl to JavaScript compiler

This is Perlito, a compiler collection that implements Perl 5 and Perl 6 programming languages.

Compile Perl to Java

  • compile Perl 5 to Java source code

  • run Perl 5 directly in the JVM

Compile Perl to JavaScript

  • compile Perl 5 to JavaScript source code; run Perl 5 directly in the browser or nodejs

  • compile Perl 6 to JavaScript source code; run Perl 6 directly in the browser or nodejs

Compile Perl to other backends

Perlito can also compile Perl 5 or Perl 6 programs into one of these languages:

  • compile Perl 5 to Perl 5

  • compile Perl 6 to Perl 5

  • compile Perl 6 to Python 2.6

The following compilers are work in progress - some tests pass, some tests fail. Check the Changelog file for details:

  • compile Perl 5 to Perl 6

  • compile Perl 6 to Ruby 1.9

  • compile Perl 6 to Go

  • compile Perl 6 to Common Lisp (SBCL)

Web

Main Perlito repository: http://github.com/fglock/Perlito

Main Project web page: http://fglock.github.io/Perlito

Run Perlito online, in the browser:

CPAN distribution:

Source code

The source code for Perlito5 can be found in the 'src5' directory. Perlito5 is written mostly in Perl 5 (the grammar uses its own mini-language.)

The source code for Perlito6 can be found in the 'src6' directory. Perlito6 is written in Perl 6.

See Also

Build Status

Build Status

perlito's People

Contributors

atoy40 avatar audreyt avatar azawawi avatar bdevetak avatar book avatar brunorc avatar cjedilo avatar coke avatar dionys avatar fglock avatar fredericorecsky avatar imran1505 avatar lablua avatar lukefalsina avatar nferraz avatar ovidiurosu90 avatar pmurias avatar potyl avatar sbertrang avatar shalokshalom avatar shlomif avatar yati-sagade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

perlito's Issues

License violation?

Only a big deal if you care, but it looks like this website is using perlito without including the Artistic License? I'm def not a lawyer and can't remember what's required for users of AL2 but I thought you had to at least include the license. Anyway check it out here: http://www.guru99.com/try-perl.html

«Error: Died: method not found: seq_build_by in class Games::Solitaire::Verify::VariantParams» after building expand-solitaire-multi-card-moves

Running this script:

#!/bin/bash

git_repo="$HOME/progs/freecell/git"
gsv="$git_repo/fc-solve/cpan/Games-Solitaire-Verify"

inc()
{
    local path="$1"
    shift
    echo "-I" "$gsv/$path/lib"
}

BASE="MyDir"
BASE_LIB="MyDir/lib"

for bn in "Games-Solitaire-Verify" "POSIX--replacement" "Exception-Class--replacement" "Getopt-Long--replacement" "List-Util--replacement" "Class-XSAccessor--replacement" ; do
    p="$gsv/$bn/lib"
    find "$p" -name '*.pm' | (while read fn ; do
        g="${fn##$p/}"
        mkdir -p "$BASE_LIB/$(dirname "$g")"
        perl -lp -MSQ -e 's#\Ause parent $sq([^$sq]+)$sq;#use $1 (); use vars qw(\@ISA); \@ISA = (qw($1));#' < "$fn" > "$BASE_LIB/$g"
    done)
done

# perl -MCarp::Always perlito5.pl -Cjs -I src5/lib/ $(inc "Games-Solitaire-Verify") $(inc "POSIX--replacement") $(inc "Exception-Class--replacement") $(inc "Getopt-Long--replacement") $(inc "List-Util--replacement") $(inc "Class-XSAccessor--replacement")  "$gsv"/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves
perl -MCarp::Always perlito5.pl -Cjs -I src5/lib/ -I "$BASE_LIB" "$gsv"/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves

gives me this:

shlomif@telaviv1:~$ node ~/expand-solitaire-multi-card-moves.js 

/home/shlomif/expand-solitaire-multi-card-moves.js:931
                throw(err)
                      ^
Error: Died: method not found: seq_build_by in class Games::Solitaire::Verify::VariantParams
Error
    at CORE.die (/home/shlomif/expand-solitaire-multi-card-moves.js:1907:24)
    at p5call (/home/shlomif/expand-solitaire-multi-card-moves.js:181:20)
    at /home/shlomif/expand-solitaire-multi-card-moves.js:3780:8
    at p5for_lex (/home/shlomif/expand-solitaire-multi-card-moves.js:922:13)
    at tmp179 [as _init] (/home/shlomif/expand-solitaire-multi-card-moves.js:3774:5)
    at p5call (/home/shlomif/expand-solitaire-multi-card-moves.js:156:44)
    at tmp106 (/home/shlomif/expand-solitaire-multi-card-moves.js:2248:5)
    at p5call (/home/shlomif/expand-solitaire-multi-card-moves.js:160:20)
    at p5pkg.POSIX.List_ISA (/home/shlomif/expand-solitaire-multi-card-moves.js:3881:60)
    at /home/shlomif/expand-solitaire-multi-card-moves.js:3926:4

Seems like the method is not constructed in run time.

Perlito Version information

Given that i am currently embedding it in Farabi, I need to put Perlito version information in the about dialog. Is there such a facility?

Some Perl6 programs won't compile

I tried to run this program with the Perl6 compiler, but it won't compile:


# this example is from Rosetta Code:
# https://rosettacode.org/wiki/99_Bottles_of_Beer#Perl_6

my $b = 99;
 
repeat while --$b {
    say "{b $b} on the wall";
    say "{b $b}";
    say "Take one down, pass it around";
    say "{b $b-1} on the wall";
    say "";
}
 
sub b($b) {
    "$b bottle{'s' if $b != 1} of beer";
}

This is the error from the compiler log:

Compiling.
Emitting javascript.
Finished compilation unit at pos 320 of 320
Error:
{}
Compilation aborted.

Why does this program not compile?

Perlito java dies with Not an ARRAY reference at perlito5.pl line 14819.

If I run the following command:

perl perlito5.pl -Isrc5/lib -Cjava sample.pl  > sample.java

Perlito dies with:

Not an ARRAY reference at perlito5.pl line 14819.

That line of code is

                    package Perlito5::AST::Call;
                    {
                        sub Perlito5::AST::Call::get_captures {
                            my $self = shift;
                            my @var;
                            ref($self->{'method'}) && push(@var, $self->{'method'}->get_captures());
                            push(@var, $self->{'invocant'}->get_captures());
                            $self->{'arguments'} && push(@var, map {
                                $_->get_captures()  # <--- *** HERE ***
                            } @{$self->{'arguments'}});
                            return @var
                        }
                    }

Sample input file:

package foo;

sub parse {

    my ($var) = (
        {  'Booking Android Apps Universal' => [ 1 ] }
    );

    return $var->{'Booking Android Apps Universal'}[0];
}

1;

perldoc -f open (and possibly some other related filehandle functions?) is not implemented yet

perldoc -f open (and possibly some other related filehandle functions?) is not implemented yet. If I do using the fc-solve git master this:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ bash /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/pack-for-perlito.bash > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ pi-make-microsoft-freecell-board -t 24 | fc-solve -p -t -sam -sel > ~/24.sol
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js ~/24.sol

/home/shlomif/e.js:7145
                                                p5or(p5pkg["Games::Solitaire::Verify::App::CmdLine::Expand"].open([v_fh,
                                                                                                             ^
TypeError: Object [object Object] has no method 'open'
    at tmp499 [as run] (/home/shlomif/e.js:7145:68)
    at p5call (/home/shlomif/e.js:156:44)
    at /home/shlomif/e.js:7172:2
    at Object.<anonymous> (/home/shlomif/e.js:7173:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

Please look into fixing it.

Regards,

-- Shlomi Fish

Getting started? Errors with perl5

Apologies if I'm missing something very fundamental. I probably am. But I just installed Perlito5 via cpanm and am having no luck getting started.

I tried running the example code in the synopsis section of the Perlito5 POD, and get all sorts of errors:

String found where operator expected at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 57, near "Perlito5::Compiler::error "No such class $type""
        (Do you need to predeclare Perlito5::Compiler::error?)
String found where operator expected at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 61, near "Perlito5::Compiler::error "No package name allowed for variable $var->{sigil}$var->{name} in \"$declarator\"""
        (Do you need to predeclare Perlito5::Compiler::error?)
String found where operator expected at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 84, near "Perlito5::Compiler::error "No such class $type""
        (Do you need to predeclare Perlito5::Compiler::error?)
syntax error at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 4, near "<."
syntax error at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 15, near "}"
syntax error at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 36, near "["
syntax error at /home/ah/.plenv/versions/5.28.0/lib/perl5/site_perl/5.28.0/Perlito5/Grammar/CORE.pm line 44, near "}"

When I try running the perlito5 command, I get similar results.

I've tried multiple Perlito releases, and multiple Perl versions (perl 5.18, 5.26.1, and 5.28.0).
Am I not supposed to be using stock perl5 to run this stuff?

I posted this question to Perlmonks and the only response I've gotten so far is the suggestion to post here.

Thanks!

Missing licence statement

I did not find a licence specified in the repository so I would suggest adding a licence statement.

Tests fail on perl built with -Duselongdouble

Perlito5-9.022-0 $ prove -vwb t/number_string.t
:
ok 14 - start with 0 + noise
not ok 15 - overflow to Inf
:
ok 16 - malformed exponent
ok 17 - malformed exponent
Argument "1acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 21.
Argument "67000acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 23.
Argument "0acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 25.
Argument "1.5acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 28.
Argument "-1acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 30.
Argument "-1.5acmfd" isn't numeric in numeric ne (!=) at t/number_string.t line 32.
Argument "033e4-1652-4" isn't numeric in numeric ne (!=) at t/number_string.t line 38.
Argument "033e4054-1652-4" isn't numeric in numeric ne (!=) at t/number_string.t line 41.
Argument "547137e" isn't numeric in numeric ne (!=) at t/number_string.t line 44.
Argument "547137e-x" isn't numeric in numeric ne (!=) at t/number_string.t line 46.
Failed 1/17 subtests

Test Summary Report
-------------------
t/number_string.t (Wstat: 0 Tests: 17 Failed: 1)
  Failed test:  15
Files=1, Tests=17,  0 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU)
Result: FAIL

I fixed that by adding a 9

print "not " if "033e40549-1652-4" != "Inf";
say  "ok 15 - overflow to Inf";

PASS

Summary of my perl5 (revision 5 version 24 subversion 1) configuration:

  Platform:
    osname=linux, osvers=4.4.49-16-default, archname=x86_64-linux-thread-multi-ld
    uname='linux tux 4.4.49-16-default #1 smp sun feb 19 17:40:35 utc 2017 (70e9954) x86_64 x86_64 x86_64 gnulinux '
    config_args='-Duse64bitall -Duselongdouble -Dusethreads -Duseithreads -Dinc_version_list=none -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=define
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='ccache cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/pro/local/include'
    ccversion='', gccversion='4.8.5', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
    ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
    alignbytes=16, prototype=define
  Linker and Libraries:
    ld='ccache cc', ldflags ='-L/pro/local/lib -fstack-protector'
    libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.22.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.22'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/pro/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_LONG_DOUBLE
                        USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
  Built under linux
  Compiled at Mar 14 2017 17:03:50
  @INC:
    /pro/lib/perl5/site_perl/5.24.1/x86_64-linux-thread-multi-ld
    /pro/lib/perl5/site_perl/5.24.1
    /pro/lib/perl5/5.24.1/x86_64-linux-thread-multi-ld
    /pro/lib/perl5/5.24.1
    .

Perlito java regexps whitespace mismatch with /[a b]/x

This is more of a reminder as Flavio is already aware that Perl and Java behave differently when dealing with /[a b]/x. In Perl that regexp is equivalent to /[a b]/ while in Java it is equivalent to /[ab]/.

This tends to break even more when we use /[ ]/x to refer to /\ /.

Sample file:

my $input = 'a b c';
my $regexp_string = qq{a [ ] b \\s c};
print "Trying '$input' =~ /$regexp_string/x\n";
$input =~ /$regexp_string/x or die "Failed regexp string: '$input' =~ /$regexp_string/x";
print "Ok '$input' =~ /$regexp_string/x\n";

Perl output:

Trying 'a b c' =~ /a [ ] b \s c/x
Ok 'a b c' =~ /a [ ] b \s c/x

Java output:

Trying 'a b c' =~ /a [ ] b \s c/x
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 11
a [ ] b \s c
           ^
    at java.util.regex.Pattern.error(Pattern.java:1955)
    at java.util.regex.Pattern.clazz(Pattern.java:2548)
    at java.util.regex.Pattern.sequence(Pattern.java:2063)
    at java.util.regex.Pattern.expr(Pattern.java:1996)
    at java.util.regex.Pattern.compile(Pattern.java:1696)
    at java.util.regex.Pattern.<init>(Pattern.java:1351)
    at java.util.regex.Pattern.compile(Pattern.java:1054)
    at PlRegex.<init>(Main.java:1209)
    at Main.main(Main.java:3498)

throw(new p5_error("die", "Died: " + s)); error in node after successfully building expand-solitaire-multi-card-moves from branch

Hi,

after running this script, where $git_repo points to https://github.com/shlomif/fc-solve - branch Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long :

#!/bin/bash

git_repo="$HOME/progs/freecell/git"
gsv="$git_repo/fc-solve/cpan/Games-Solitaire-Verify"

inc()
{
    local path="$1"
    shift
    echo "-I" "$gsv/$path/lib"
}

perl -MCarp::Always perlito5.pl -Cjs -I src5/lib/ $(inc "Games-Solitaire-Verify") $(inc "POSIX--replacement") $(inc "Exception-Class--replacement") $(inc "Getopt-Long--replacement") $(inc "List-Util--replacement") $(inc "Class-XSAccessor--replacement")  "$gsv"/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves

I am getting this error:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js

/home/shlomif/e.js:1911
    throw(new p5_error("die", "Died: " + s));
          ^
Error: 

Can you try to investigate, please?

P.S: I tried using Emscripten and it worked but the generated code was far too slow - see http://www.shlomifish.org/microperl-web-repl-v1/repl.html so i'm trying Perlito again.

Regards,

-- Shlomi Fish

«TypeError: Cannot call method 'require' of undefined» after compiling expand-solitaire-multi-card-moves

After I compile perlito and run it on the code here - https://github.com/shlomif/fc-solve/tree/Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long , I'm getting an error:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js
/home/shlomif/e.js:2330
                p5pkg["Perlito5::Grammar::Use"]["require"]([p5str('Games::Solitaire::Verify:
                                                          ^
TypeError: Cannot call method 'require' of undefined
    at p5pkg.Fcntl.List_ISA (/home/shlomif/e.js:2330:45)
    at /home/shlomif/e.js:2389:4
    at Object.<anonymous> (/home/shlomif/e.js:8435:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Please look into fixing it.

Regards, -- @shlomif

Paths specified in the -I flags don't take precedence over those in the system paths.

as can be seen in the output below the -I flags don't take precedence over the system paths or those specified in $PERL5LIB:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ strace -o perl.strace -f perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves  > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perldoc -l Games::Solitaire::Verify::App::CmdLine::Expand
/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/App/CmdLine/Expand.pm
$ ls -l /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib/Games/Solitaire/Verify/App/CmdLine/Expand.pm
-rw-r--r-- 1 shlomif shlomif 5337 Oct 18 17:41 /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib/Games/Solitaire/Verify/App/CmdLine/Expand.pm
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perldoc -l Games::Solitaire::Verify::App::CmdLine::Expand^C                                            shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perldoc -l Games::Solitaire::Verify::App::CmdLine::Expand                                              /usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/App/CmdLine/Expand.pm
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ ls -l /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib/Games/Solitaire/Verify/App/CmdLine/Expand.pm
-rw-r--r-- 1 shlomif shlomif 5337 Oct 18 17:41 /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib/Games/Solitaire/Verify/App/CmdLine/Expand.pm
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ strace -o perl.strace -f perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves  > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ cat perl.strace | grep Verify
9178  open("/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves", O_RDONLY) = 3
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/App/CmdLine/Expand.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/App/CmdLine/Expand.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/App/CmdLine/Expand.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/App/CmdLine/Expand.pm", {st_mode=S_IFREG|0444, st_size=4460, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/App/CmdLine/Expand.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 4460
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/VariantsMap.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/VariantsMap.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/VariantsMap.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/VariantsMap.pm", {st_mode=S_IFREG|0444, st_size=8556, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/VariantsMap.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 8192
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm", {st_mode=S_IFREG|0444, st_size=13270, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 8192
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Exception.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Exception.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Exception.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Exception.pm", {st_mode=S_IFREG|0444, st_size=7362, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Exception.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 7362
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Card.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Card.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Card.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Card.pm", {st_mode=S_IFREG|0444, st_size=6765, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Card.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 6765
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Column.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Column.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Column.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Column.pm", {st_mode=S_IFREG|0444, st_size=4958, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Column.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 4958
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Move.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Move.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Move.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Move.pm", {st_mode=S_IFREG|0444, st_size=4287, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Move.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 4287
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/State.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/State.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/State.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/State.pm", {st_mode=S_IFREG|0444, st_size=20076, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/State.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 8192
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Freecells.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Freecells.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Freecells.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Freecells.pm", {st_mode=S_IFREG|0444, st_size=5075, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Freecells.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 5075
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Foundations.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/Foundations.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/Foundations.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Foundations.pm", {st_mode=S_IFREG|0444, st_size=4958, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/Foundations.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 4958
9178  stat("/usr/lib/perl5/site_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/VariantParams.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/site_perl/5.20.1/Games/Solitaire/Verify/VariantParams.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Games/Solitaire/Verify/VariantParams.pm", 0x18d3238) = -1 ENOENT (No such file or directory)
9178  stat("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/VariantParams.pm", {st_mode=S_IFREG|0444, st_size=6165, ...}) = 0
9178  open("/usr/lib/perl5/vendor_perl/5.20.1/Games/Solitaire/Verify/VariantParams.pm", O_RDONLY) = 3
9178  read(3, "package Games::Solitaire::Verify"..., 8192) = 6165
9178  write(1, "s::Solitaire::Verify::State\", \"t"..., 8192) = 8192
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 

Perlito5::Javascript2::IO

My test program is:

print "hello";

I compile:

perl perlito5.pl -Cjs ./test.pl > ./test.js

When i run test.js in chrome, I get the message

"Uncaught ReferenceError: write is not defined"

It works fine in NodeJS though. I am inexperienced with the perlito compiler, but I found out that at line 489 on Perlito5::Javascript2::IO

       write(p5str(List__[i]));

looks doubtful. Everything works if I replace this with console.log or document.write. If nodejs is used
this line is never executed (nodejs ./test.js).

s/// does not return the replacements' count

This perl program:

#!/usr/bin/perl

use strict;
use warnings;

my $x = "130";

if ($x !~ s/\A=//)
{
    print "Succeeded.\n";
}
else
{
    print "Failed!\n";
}

is successful when being compiled and ran by /usr/bin/perl, but fails with Perlito:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib test1.pl > ~/n.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/n.js
Failed!

This is the latest obstacle with the translation of Games-Solitaire-Verify to JS.

"perl perlito5.pl -Cjs" gives an unhelpful error on building a Games-Solitaire-Verify executable

After I run this script in the Perlito directory in the master branch, I'm getting this output.

Script:

#!/bin/bash

set -x

wget -c 'http://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Games-Solitaire-Verify-0.1203.tar.gz'
tar -xzvf Games-Solitaire-Verify-0.1203.tar.gz

perl perlito5.pl -Cjs -I src5/lib/ -IGames-Solitaire-Verify-0.1203/lib Games-Solitaire-Verify-0.1203/script/expand-solitaire-multi-card-moves

Output:

+ wget -c http://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Games-Solitaire-Verify-0.1203.tar.gz
--2014-03-14 11:18:10--  http://cpan.metacpan.org/authors/id/S/SH/SHLOMIF/Games-Solitaire-Verify-0.1203.tar.gz
Resolving cpan.metacpan.org (cpan.metacpan.org)... 185.31.18.192, 185.31.18.129
Connecting to cpan.metacpan.org (cpan.metacpan.org)|185.31.18.192|:80... connected.
HTTP request sent, awaiting response... 200 OK

    The file is already fully retrieved; nothing to do.

+ tar -xzvf Games-Solitaire-Verify-0.1203.tar.gz
Games-Solitaire-Verify-0.1203
Games-Solitaire-Verify-0.1203/Changes
Games-Solitaire-Verify-0.1203/LICENSE
Games-Solitaire-Verify-0.1203/MANIFEST
Games-Solitaire-Verify-0.1203/Build.PL
Games-Solitaire-Verify-0.1203/Makefile.PL
Games-Solitaire-Verify-0.1203/META.yml
Games-Solitaire-Verify-0.1203/META.json
Games-Solitaire-Verify-0.1203/README
Games-Solitaire-Verify-0.1203/COPYING
Games-Solitaire-Verify-0.1203/lib
Games-Solitaire-Verify-0.1203/lib/Games
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Exception.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/VariantsMap.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/VariantParams.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Base.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/KlondikeTalon.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Solution.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Move.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/State.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Column.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Foundations.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Freecells.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Card.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/App
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/App/CmdLine.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/App/CmdLine
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/App/CmdLine/Expand.pm
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Solution
Games-Solitaire-Verify-0.1203/lib/Games/Solitaire/Verify/Solution/ExpandMultiCardMoves.pm
Games-Solitaire-Verify-0.1203/examples
Games-Solitaire-Verify-0.1203/examples/expand-moves-driver.pl
Games-Solitaire-Verify-0.1203/inc
Games-Solitaire-Verify-0.1203/inc/Test
Games-Solitaire-Verify-0.1203/inc/Test/Run
Games-Solitaire-Verify-0.1203/inc/Test/Run/Builder.pm
Games-Solitaire-Verify-0.1203/t
Games-Solitaire-Verify-0.1203/t/06-verify-moves.t
Games-Solitaire-Verify-0.1203/t/03-card.t
Games-Solitaire-Verify-0.1203/t/00-load.t
Games-Solitaire-Verify-0.1203/t/04-column.t
Games-Solitaire-Verify-0.1203/t/style-trailing-space.t
Games-Solitaire-Verify-0.1203/t/08-expand-solution.t
Games-Solitaire-Verify-0.1203/t/pod-coverage.t
Games-Solitaire-Verify-0.1203/t/01-base.t
Games-Solitaire-Verify-0.1203/t/cpan-changes.t
Games-Solitaire-Verify-0.1203/t/pod.t
Games-Solitaire-Verify-0.1203/t/02-move.t
Games-Solitaire-Verify-0.1203/t/05-state.t
Games-Solitaire-Verify-0.1203/t/07-solution.t
Games-Solitaire-Verify-0.1203/t/data
Games-Solitaire-Verify-0.1203/t/data/sample-solutions
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-eight-off-200.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-eight-off-200-l-gi.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-larrysan-kings-only-0-freecells-unlimited-move.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-freecell-24-wrong-2.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-forecell-24.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-bakers-game-24.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-relaxed-freecell-11982.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-freecell-24-wrong-1.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-freecell-24.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-seahaven-towers-1977.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-freecell-9-orig.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-simple-simon-24.txt
Games-Solitaire-Verify-0.1203/t/data/sample-solutions/fcs-freecell-9-expanded.txt
Games-Solitaire-Verify-0.1203/script
Games-Solitaire-Verify-0.1203/script/bump-version-number.pl
Games-Solitaire-Verify-0.1203/script/tag-release.pl
Games-Solitaire-Verify-0.1203/script/expand-solitaire-multi-card-moves
Games-Solitaire-Verify-0.1203/script/verify-solitaire-solution
Games-Solitaire-Verify-0.1203/script/play-and-verify-klondike
+ perl perlito5.pl -Cjs -I src5/lib/ -IGames-Solitaire-Verify-0.1203/lib Games-Solitaire-Verify-0.1203/script/expand-solitaire-multi-card-moves
Number or Bareword found where operator expected at perlito5.pl line 1147.

I don't understand the error and it does not point to correct it. This executable is built fine with perl5 (5.18.2 in my case, but also many older versions). What is the problem and how to fix it? I should note that I'm using Class::XSAccessor which is an XS module.

Regards,

-- Shlomi Fish

Perlito fails some tests in de8dc246ad38b0acc2dfa1dbd1e6344315720b36

Hi!

Perlito fails some tests in de8dc24 on Mageia Linux 3/Cauldron on x86-64:


Test Summary Report
-------------------
t5/01-perlito/10-bind-sub-param.t    (Wstat: 0 Tests: 5 Failed: 1)
  Failed test:  4
t5/01-perlito/17-hash-autovivify.t   (Wstat: 0 Tests: 8 Failed: 1)
  Failed test:  8
t5/01-perlito/19-local.t             (Wstat: 0 Tests: 7 Failed: 1)
  Failed test:  2
Files=43, Tests=391, 31 wallclock secs ( 0.23 usr  0.04 sys + 29.40 cusr  1.95 csys = 31.62 CPU)
Result: FAIL
make: *** [test-5js] Error 1

Please look into fixing those tests.

Regards,

-- Shlomi Fish

Lost Java types

I have test script which imported java class:

package Java::Object { import => 'java.lang.Object' };
my Java::Object $obj = Java::Object->new();

So I try to run and got error:

> java -jar perlito5.jar -I src5/lib test.pl
/PlEval1.java:14: error: <identifier> expected
            obj_102 = new ();
                         ^
1 error
Unknown error during compilation. at test.pl

But this works ok:

 perl perlito5.pl -I src5/lib -C java test.pl > test.java; javac test.java; java Main

Configuration:

> java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

and last master.

compile errors

  1. All invocations like ::error "foo"; need parens:
$ node perlito5.js -I src5/lib -I /pro/lib/perl5/site_perl/5.22.0 ../Text-CSV6/csv-test-pp.pl
Can't call method Perlito5::Compiler::error on unblessed reference at ../Text-CSV6/csv-test-pp.pl line 143

to start:

vi +18 Perlito5/Grammar/Attribute.pm
vi +273 Perlito5/Grammar/Sigil.pm
vi +123 Perlito5/Grammar/Scope.pm
vi +3205 Perlito5/Java/Emitter.pm
  1. All modules need a true value at the end

Perlito5/Macro.pm needs a 1; on line 407

The script I started to test with is

#!/usr/bin/perl

use strict;
use warnings;

use Text::CSV_PP;

my @rows;
my $csv = Text::CSV_PP->new ({ binary => 1, auto_diag => 1 } )
    or die "Cannot use CSV: ", Text::CSV->error_diag ();

my $sum = 0;
while (my $row = $csv->getline (*ARGV)) {
    $sum += scalar @$row;
    }
print "$sum\n";

where the input is a valid CSV file

Alternatively this is smaller PP code:

#!/usr/bin/perl

use strict;
use warnings;

use Text::CSV::Easy_PP qw(csv_parse);

my $sum = 0;
while (my $line = <>) {
    my @row = csv_parse ($line);
    $sum += @row;
    }
print "$sum\n";

successive runs of perl code giving different resulsts

Hi, I have a piece of perl code and run it using the online compiler, the first run gave the correct results, but if I click the Excute and run it again, the results change and are not correct now. I need to refresh the page to run again. Is there something like clearing all the memory for each run?

Perlito java generates "random" java code

I need to keep under revision control the java file that perlito generates is always changing. Methods in classes are never in the same order. I suspect this to be to perl's internal hashes which don't guarantee order even among program reruns.

I tried changing the sort order in my branch https://github.com/potyl/Perlito/tree/emo/java-sorted but there are still some methods that keep changing places in the resulting output file.

Can you advice me on how to finish this patch?

-Cjs fails with nodejs v0.10.25

$ nodejs perlito5.js -Cjs -Isrc5/lib -e 'use strict; say 1'

it looks like this line in Perlito5::Javascript2::Emitter:
$decl->isa( 'Perlito5::AST::Decl' ) && $decl->decl eq 'my' )
returns true for the ast node 'Perlito5::AST::Use'

Perlito java regexps generated at runtime need to be double escaped

This is a case where Perl code and generated Java code differ in implementation. Basically if we generate in Perl a regexp in real time (as a string) and use it to evaluate a pattern the regexp will fail if we have escapes. What happens is that in Perl \\s has to be used but in Java \\\\s need to be used.

Example:

#!/usr/bin/env perl
use strict;
use warnings;

my $input = 'a b c';
my $regexp_string = qq{a<SPACE>b\\sc};

my $regexp_clean = $regexp_string;
$regexp_clean =~ s/<SPACE>/\\s/;

print "Trying '$input' =~ /$regexp_clean/\n";
$input =~ /$regexp_clean/ or die "Failed regexp clean: '$input' =~ /$regexp_clean/";
print "Ok '$input' =~ /$regexp_clean/\n";

Perl output:

Trying 'a b c' =~ /a\sb\sc/
Ok 'a b c' =~ /a\sb\sc/

Java output:

Trying 'a b c' =~ /asb\sc/
Exception in thread "main" PlDieException: Failed regexp clean: 'a b c' =~ /asb\sc/
    at PlCORE.die(Main.java:114)
    at Main.main(Main.java:3514)

If we modify the original program to this:

#!/usr/bin/env perl
use strict;
use warnings;

my $input = 'a b c';
my $regexp_string = qq{a<SPACE>b\\sc};

my $regexp_clean = $regexp_string;
$regexp_clean =~ s/<SPACE>/\\\\s/;

print "Trying '$input' =~ /$regexp_clean/\n";
$input =~ /$regexp_clean/ or die "Failed regexp clean: '$input' =~ /$regexp_clean/";
print "Ok '$input' =~ /$regexp_clean/\n";

Then we get a failure in Perl:

Trying 'a b c' =~ /a\\sb\sc/
Failed regexp clean: 'a b c' =~ /a\\sb\sc/ at ./sample.pl line 12.

But a success in Java:

Trying 'a b c' =~ /a\sb\sc/
Ok 'a b c' =~ /a\sb\sc/

Projectpage

I don't know if this is the right place, but I want you to know that the link to your project page http://www.perlito.org seems broken and/or not available.

This seems to be a trivial thing but is in fact a big marketing problem.
You would better remove the link.

Thanks for this project. I recently started using Perlito in some Projects and hope I can help.

Perl 5, $| = 1; # Fails

$| = 1;

Fails with the following error message:

Died: Global symbol "$|" requires explicit package name

`shift` requires parens when it doesn't need them

use 5.010;
package Car;
sub new {
    my $class = shift;
    my $color = shift() // 'red';
    bless {color => $color}, $class;
}
sub color {
    shift()->{color}
}
package main;
my $car = Car->new;
say $car->color;

In this code, shift() could be replaced with shift - that works in Perl 5, but doesn't in Perlito.

Package org.perlito.Perlito5 does not exist with jrunscript

When I try to run on last master:

jrunscript -cp .:perlito.jar -l Perl5 -e 'print 1'

I receive the following error message:

/PlEval0.java:1: error: package org.perlito.Perlito5 does not exist
import org.perlito.Perlito5.*;
^
/PlEval0.java:6: error: cannot find symbol
    public static PlObject runEval(int want, Object scalar_val, Object array_val, Object hash_val, PlArray List__) {
                                                                                                   ^
  symbol:   class PlArray
  location: class PlEval0
/PlEval0.java:6: error: cannot find symbol
    public static PlObject runEval(int want, Object scalar_val, Object array_val, Object hash_val, PlArray List__) {
                  ^
  symbol:   class PlObject
  location: class PlEval0
/PlEval0.java:9: error: cannot find symbol
            PlObject ret = new PlClosure(PlCx.UNDEF, new PlObject[]{  }, "main", true) {
            ^
  symbol:   class PlObject
  location: class PlEval0
/PlEval0.java:20: error: cannot find symbol
            }.apply(want, new PlArray());
                              ^
  symbol:   class PlArray
  location: class PlEval0
/PlEval0.java:9: error: cannot find symbol
            PlObject ret = new PlClosure(PlCx.UNDEF, new PlObject[]{  }, "main", true) {
                               ^
  symbol:   class PlClosure
  location: class PlEval0
/PlEval0.java:9: error: cannot find symbol
            PlObject ret = new PlClosure(PlCx.UNDEF, new PlObject[]{  }, "main", true) {
                                         ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:9: error: cannot find symbol
            PlObject ret = new PlClosure(PlCx.UNDEF, new PlObject[]{  }, "main", true) {
                                                         ^
  symbol:   class PlObject
  location: class PlEval0
/PlEval0.java:21: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
                                ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:21: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:24: error: cannot find symbol
        catch(PlReturnException e) {
              ^
  symbol:   class PlReturnException
  location: class PlEval0
/PlEval0.java:25: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
                                ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:25: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:28: error: cannot find symbol
        catch(PlNextException e) {
              ^
  symbol:   class PlNextException
  location: class PlEval0
/PlEval0.java:29: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
                                ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:29: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:32: error: cannot find symbol
        catch(PlLastException e) {
              ^
  symbol:   class PlLastException
  location: class PlEval0
/PlEval0.java:33: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
                                ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:33: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:36: error: cannot find symbol
        catch(PlRedoException e) {
              ^
  symbol:   class PlRedoException
  location: class PlEval0
/PlEval0.java:37: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
                                ^
  symbol:   variable PlCx
  location: class PlEval0
/PlEval0.java:37: error: cannot find symbol
            PlV.sset("main::@", PlCx.EMPTY);
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:42: error: cannot find symbol
            PlV.sset("main::@", new PlString("" + message));
                                    ^
  symbol:   class PlString
  location: class PlEval0
/PlEval0.java:42: error: cannot find symbol
            PlV.sset("main::@", new PlString("" + message));
            ^
  symbol:   variable PlV
  location: class PlEval0
/PlEval0.java:43: error: cannot find symbol
            return PerlOp.context(want);
                   ^
  symbol:   variable PerlOp
  location: class PlEval0
25 errors
script error: Unknown error during compilation.

Running make test-5jar is ok. Runing java -jar perlito5.jar -I src5/lib -e 'print 1' is ok. Only jrunscript throws the error.

In Perl 5, interpolated heredocs are broken

Examples which don't work.

say <<"HELLO";
"Perlito Perl5" running in $^O
HELLO
say <<HELLO;
"Perlito Perl5" running in $^O
HELLO

But this does

say <<'HELLO';
"Perlito Perl5" running in browser
HELLO

"Too much recursion" for the JS backend

I tried compiling the following program for fun here:

                                 $_='ev
                                       al("seek\040D
           ATA,0,                  0;");foreach(1..3)
       {<DATA>;}my               @camel1hump;my$camel;
  my$Camel  ;while(             <DATA>){$_=sprintf("%-6
9s",$_);my@dromedary           1=split(//);if(defined($
_=<DATA>)){@camel1hum        p=split(//);}while(@dromeda
 ry1){my$camel1hump=0      ;my$CAMEL=3;if(defined($_=shif
        t(@dromedary1    ))&&/\S/){$camel1hump+=1<<$CAMEL;}
       $CAMEL--;if(d   efined($_=shift(@dromedary1))&&/\S/){
      $camel1hump+=1  <<$CAMEL;}$CAMEL--;if(defined($_=shift(
     @camel1hump))&&/\S/){$camel1hump+=1<<$CAMEL;}$CAMEL--;if(
     defined($_=shift(@camel1hump))&&/\S/){$camel1hump+=1<<$CAME
     L;;}$camel.=(split(//,"\040..m`{/J\047\134}L^7FX"))[$camel1h
      ump];}$camel.="\n";}@camel1hump=split(/\n/,$camel);foreach(@
      camel1hump){chomp;$Camel=$_;y/LJF7\173\175`\047/\061\062\063\
      064\065\066\067\070/;y/12345678/JL7F\175\173\047`/;$_=reverse;
       print"$_\040$Camel\n";}foreach(@camel1hump){chomp;$Camel=$_;y
        /LJF7\173\175`\047/12345678/;y/12345678/JL7F\175\173\0 47`/;
         $_=reverse;print"\040$_$Camel\n";}';;s/\s*//g;;eval;   eval
           ("seek\040DATA,0,0;");undef$/;$_=<DATA>;s/\s*//g;(   );;s
             ;^.*_;;;map{eval"print\"$_\"";}/.{4}/g; __DATA__   \124
               \1   50\145\040\165\163\145\040\157\1 46\040\1  41\0
                    40\143\141  \155\145\1 54\040\1   51\155\  141
                    \147\145\0  40\151\156 \040\141    \163\16 3\
                     157\143\   151\141\16  4\151\1     57\156
                     \040\167  \151\164\1   50\040\      120\1
                     45\162\   154\040\15    1\163\      040\14
                     1\040\1   64\162\1      41\144       \145\
                     155\14    1\162\       153\04        0\157
                      \146\     040\11     7\047\         122\1
                      45\15      1\154\1  54\171          \040
                      \046\         012\101\16            3\16
                      3\15           7\143\15             1\14
                      1\16            4\145\163           \054
                     \040            \111\156\14         3\056
                    \040\         125\163\145\14         4\040\
                    167\1        51\164\1  50\0         40\160\
                  145\162                              \155\151
                \163\163                                \151\1
              57\156\056

And it should give the following output:

     .XXXXXXXXXXL      .XXX^XLmm       mmJX^XXX.      JXXXXXXXXXX.     
     JXXXXXXXXXXXL.   .XXXXXXXXXX     XXXXXXXXXX.   .JXXXXXXXXXXXL     
   .JXXXXXXXXXXXXXXL. {XXXXXX^^^'     `^^^XXXXXX} .JXXXXXXXXXXXXXXL.   
  .XXXXXXXXXXXXXXXXXXL XXXXXXL           JXXXXXX JXXXXXXXXXXXXXXXXXX.  
 mXXXXXXXXXXXXXXXXXXXXXXXXXXXX}         {XXXXXXXXXXXXXXXXXXXXXXXXXXXXm 
JXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'         `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXL
JXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX           XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXL
 XXFXXXXXXXXXXXXXXXXXXXXXXXXXXX'           `XXXXXXXXXXXXXXXXXXXXXXXXXXX7XX 
 XX {XXXXXXXXXXXXXXXXXXXXXXXXF'             `7XXXXXXXXXXXXXXXXXXXXXXXX} XX 
 7X.{XXX}XXXXXXXXXXXXXXXX^7F'                 `7F^XXXXXXXXXXXXXXXX{XXX}.XF 
 7}JXXF {XXX}XXXXX XXXXX                         XXXXX XXXXX{XXX} 7XXL{F 
  XXF  {XXX 7XXXX.{XXX}                         {XXX}.XXXXF XXX}  7XX  
 {XX'  {XX} `7XXX} XXX}                         {XXX {XXXF' {XX}  `XX} 
 {XX    7XX.  JXX' {XX'                         `XX} `XXL  .XXF    XX} 
  XX     ^XXmXX^'  {XX                           XX}  `^XXmXX^     XX  
  XX     .JXXX'     XX                           XX     `XXXL.     XX  
 .XX}    XXXXXLm    {XL                         JX}    mJXXXXX    {XX. 
 {XXX.   `^'`^^^'   {XXm                       mXX}   `^^^'`^'   .XXX} 
  ^^^                XXXXm                   mXXXX                ^^^  
    mmJX^XXX.      JXXXXXXXXXX.          .XXXXXXXXXXL      .XXX^XLmm   
   XXXXXXXXXX.   .JXXXXXXXXXXXL          JXXXXXXXXXXXL.   .XXXXXXXXXX  
   `^^^XXXXXX} .JXXXXXXXXXXXXXXL.      .JXXXXXXXXXXXXXXL. {XXXXXX^^^'  
      JXXXXXX JXXXXXXXXXXXXXXXXXX.    .XXXXXXXXXXXXXXXXXXL XXXXXXL     
     {XXXXXXXXXXXXXXXXXXXXXXXXXXXXm  mXXXXXXXXXXXXXXXXXXXXXXXXXXXX}    
     `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXLJXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'    
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX     
      `XXXXXXXXXXXXXXXXXXXXXXXXXXX7XX  XXFXXXXXXXXXXXXXXXXXXXXXXXXXXX'     
       `7XXXXXXXXXXXXXXXXXXXXXXXX} XX  XX {XXXXXXXXXXXXXXXXXXXXXXXXF'      
         `7F^XXXXXXXXXXXXXXXX{XXX}.XF  7X.{XXX}XXXXXXXXXXXXXXXX^7F'        
             XXXXX XXXXX{XXX} 7XXL{F  7}JXXF {XXX}XXXXX XXXXX            
             {XXX}.XXXXF XXX}  7XX    XXF  {XXX 7XXXX.{XXX}            
             {XXX {XXXF' {XX}  `XX}  {XX'  {XX} `7XXX} XXX}            
             `XX} `XXL  .XXF    XX}  {XX    7XX.  JXX' {XX'            
              XX}  `^XXmXX^     XX    XX     ^XXmXX^'  {XX             
              XX     `XXXL.     XX    XX     .JXXX'     XX             
             JX}    mJXXXXX    {XX.  .XX}    XXXXXLm    {XL            
            mXX}   `^^^'`^'   .XXX}  {XXX.   `^'`^^^'   {XXm           
          mXXXX                ^^^    ^^^                XXXXm         
The use of a camel image in association with Perl is a trademark of O'Reilly &
Associates, Inc. Used with permission.

But I get this error:

Compiling.
Compilation time: 338ms
Error:
InternalError: too much recursion
Compilation aborted.

Should be a fun exercise for the compiler :)

Syntax error with foreach and variable declaration outside of it

Hey, very cool project. I am trying to compile one of my parsers and discovered a weird and easy to fix case:

The below does not compile, Syntax Error in sub 'leftmostsubrules' at ./perlito5.pl line 5851

my $prod;
foreach $prod ( @{$self->{"prods"}} )
{
    return 1 if $prod->hasleftmost($ref);
}

But this does:

foreach my $prod ( @{$self->{"prods"}} )
{
    return 1 if $prod->hasleftmost($ref);
}

p5tr should be implemented

After I replaced the require with a use in that fc-solve branch, I got this:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js 
/home/shlomif/e.js:2555
                p5tr(p5pkg["File::Spec"]["v_VERSION"], '_', '');
                ^
ReferenceError: p5tr is not defined
    at p5pkg.Scalar::Util.List_ISA (/home/shlomif/e.js:2555:3)
    at /home/shlomif/e.js:2565:4
    at Object.<anonymous> (/home/shlomif/e.js:8436:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 

It is written that:

        elsif ($code eq 'p5:tr') {
            # TODO: tr/// not implemented
            $str =  
                 'p5tr(' . $var->emit_javascript3() . ', ' . $regex_args->[0]->emit_javascript3() . ', ' . $regex_args->[1]->emit_javascript3() . ')'
        }

Perhaps you'd like to try to get the code in Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long branch fully functional to avoid the round-trip delays.

split (//, $s) is not handled well - results in a JS with a comment

The code is taken from this branch:

https://github.com/shlomif/fc-solve/tree/Games-Solitaire-Verify--for-Perlito--Get-Rid-of-Getopt-Long

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl perlito5.pl -Cjs -I src5/lib/ -I/home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/lib /home/shlomif/progs/freecell/git/fc-solve/cpan/Games-Solitaire-Verify/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves > ~/e.js
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node ~/e.js 

/home/shlomif/e.js:5144
                                                var tmp276 = tmp275.slice(0);
                                                ^^^
SyntaxError: Unexpected token var
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ perl -lane 'print if 5140..5150' ~/e.js 
                                        var v_rank;
                                        var v_suit;
                                        (function () {
                                                var tmp275 = p5list_to_a(p5pkg["Games::Solitaire::Verify::Card"].split(p5list_to_a((p5str(p5pkg["Games::Solitaire::Verify::Card"]["v__"]).match(//) ? 1 : 0), v_str), 1));
                                                var tmp276 = tmp275.slice(0);
                                                v_rank = tmp275.shift();
                                                v_suit = tmp275.shift();
                                                return tmp276
                                        })();
                                        if ( !( (p5call(v_self, "rank", p5list_to_a(p5call(v_self, "calc_rank", [v_rank], 1)), 0) != null)) ) {
                                                p5call(p5pkg["Games::Solitaire::Verify::Exception::Parse::Card::UnknownRank"], "throw", ['error', 'unknown rank'], null);
shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ 

Add Homebrew formula for Perlito executables

It'd be awesome to have Perlito installable on Mac OS with Homebrew.

That's pretty much it. Reason I'm filing an issue for this instead of adding it myself is because formula submissions need to come from official sources - simply having a "yeah, it's probably okay" or "the submitter said go ahead" isn't good enough.

Minified version of Perlito JavaScript

It would be useful to have a minified version of Perlito JavaScript file to reduce the size of transferred code over the network. Any chance of implementing this soon?

I used Google Closure compiler on Perlito and i discovered a couple of errors:
http://closure-compiler.appspot.com/home

If you want to automate it, please use https://metacpan.org/module/WebService::Google::Closure

Better yet, here is the code

use Modern::Perl;

require WebService::Google::Closure;
my $response = WebService::Google::Closure->new(
    url => "https://raw.github.com/fglock/Perlito/master/html/perlito5.js",
    compilation_level => 3,
)->compile;

if ( $response->has_errors ) {
    for ( @{ $response->errors } ) {
        say "Type: " . $_->type;
        say "File: " . $_->file;
        say "Line: " . $_->lineno;
        say "Column: " . $_->charno;
        say "Text: " . $_->text;
    }

}
else {
    say "Original Size = " . $response->stats->original_size;
    say "Compressed Size = " . $response;
    say "Response:";
    say $response->code;
}

Code examples on website don't compile

The 'Perl5' and 'Perl5 to Perl6' code examples on the website fail to compile.

Hitting 'execute' on https://fglock.github.io/Perlito/perlito/perlito5.html results in

Compiling.
Error:
Value tokens must be separated by an operator (did you forget a comma?) at  line 14

Compilation aborted.

Hitting 'execute' on https://fglock.github.io/Perlito/perlito/perlito5to6.html results in

Compiling.
Error:
Bareword found where operator expected at  line 10

Compilation aborted.

The 'Perl6' example seems to work.

perlito5.js throws an error with the "Hello World" program.

When I run node perlito5.js on Mageia Linux Cauldron (with perl-5.18.1-3.mga4 and nodejs-0.10.22-1.mga4 ) I get:

shlomif@telaviv1:~/Download/unpack/perl/Perlito/Perlito$ node perlito5.js -I./src5/lib -e 'print "Hi!\n"'
Warning: RangeError: Maximum call stack size exceeded
undefined
Error
    at CORE.warn (/home/shlomif/Download/unpack/perl/Perlito/Perlito/perlito5.js:1142:24)
    at p5pkg.main.Hash_INC (/home/shlomif/Download/unpack/perl/Perlito/Perlito/perlito5.js:18128:23)
    at /home/shlomif/Download/unpack/perl/Perlito/Perlito/perlito5.js:18130:8
    at Object.<anonymous> (/home/shlomif/Download/unpack/perl/Perlito/Perlito/perlito5.js:18279:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)

"make test" is also failing all tests.

Please look into fixing it.

Regards,

-- Shlomi Fish

java -jar perlito5.jar -Isrc5/lib array.t failed to run with OpenJDK (not official Java)

Hi,

I forked the perliot project and built it successfully.
As described in the project README, I tried to run the test, and got the following error:

java -jar perlito5.jar -Isrc5/lib array.t
java.lang.NullPointerException
        at org.perlito.Perlito5.PlJavaCompiler.compileClassInMemory(PlJavaCompiler.java:390)
        at org.perlito.Perlito5.PlJavaCompiler.eval_perl_string(PlJavaCompiler.java:325)
        at org.perlito.Perlito5.Main$61.apply(Main.java:4335)
        at org.perlito.Perlito5.PlLvalue.apply(PlLvalue.java:533)
        at org.perlito.Perlito5.PlStringConstant.apply(PlStringConstant.java:160)
        at org.perlito.Perlito5.Main.main(Main.java:4775)
org.perlito.Perlito5.PlDieException: null pointer: java.lang.NullPointerException at array.t line 1

        at org.perlito.Perlito5.PlCORE.die(PlCORE.java:955)
        at org.perlito.Perlito5.LibPerl$358.apply(LibPerl.java:24668)
        at org.perlito.Perlito5.PlLvalue.apply(PlLvalue.java:533)
        at org.perlito.Perlito5.PlStringConstant.apply(PlStringConstant.java:160)
        at org.perlito.Perlito5.Main.main(Main.java:4777)

I'm using OpenJDK Java 1.8:
java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)

Thanks,
Yaakov

Supposedly blessed reference is not blessed

I have a file A.pm:

package A;

sub test {
bless {};
}

sub somemethod {
print "test";
}

1;

and test.pl:

use A;

works:

A->somemethod();

dies:

A->test()->somemethod();

Now if i run

perl test.pl

Output is:

testtest

But if instead

nodejs ./perlito5.js -I./src5/lib -I./lib -I. ./test.pl

I get:

testCan't locate object method "somemethod" via package "undefined" (perhaps you forgot to load "undefined"?) at ./test.pl line 13
Error
at CORE.die (/home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:2746:28)
at p5call (/home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:192:20)
at eval (eval at (/home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42606:56), :17:2)
at eval (eval at (/home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42606:56), :19:3)
at /home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42606:11
at /home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42627:7
at /home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42643:6
at /home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42950:5
at /home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42963:4
at Object. (/home/ipe/Fortress/game_perl/Perlito-master/perlito5.js:42964:3)

So the method test does not return a blessed reference as it should. I have compiled perlito5.js using build-5js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.