fglock / Perlito

"Perlito" Perl programming language compiler
http://fglock.github.io/Perlito/
Other
414 stars 47 forks source link

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

Open shlomif opened 10 years ago

shlomif commented 10 years ago

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

fglock commented 10 years ago

Perlito doesn't support XS (not yet) - perl is made of many mini-languages, and XS is one of the most complicated, because it is exposing internal implementation details.

I'll investigate the syntax error message, thanks for reporting.

(sorry for the delay, the github message was filtered out.)

2014-03-14 10:19 GMT+01:00 Shlomi Fish notifications@github.com:

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 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

Reply to this email directly or view it on GitHubhttps://github.com/fglock/Perlito/issues/20 .

shlomif commented 10 years ago

@fglock: thanks for returning to me.

I guessed so regarding XS, and I suppose I can try creating a built-in pure-Perl replacement for Class::XSAccessor or use a different accessor generator that doesn't have this issue.

Thanks for going to investigate the syntax error message.

Regards,

— @shlomif

shlomif commented 9 years ago

@fglock : any news?

fglock commented 9 years ago

I'm currently studying how to implement the "vm" side of Perlito. I've started a machine-code backend, but that didn't go too far. Next step will probably be an interpreter.

2014-10-10 8:08 GMT+02:00 Shlomi Fish notifications@github.com:

@fglock https://github.com/fglock : any news?

— Reply to this email directly or view it on GitHub https://github.com/fglock/Perlito/issues/20#issuecomment-58616135.

shlomif commented 9 years ago

@fglock: hi, that's nice and all , but I meant if there's any progress being made with solving this bug and the other showstopped bug I reported. If we are to believe the Joel Test then at any given moment, the priority should be given to fix bugs:

http://www.joelonsoftware.com/articles/fog0000000043.html

Regards,

-- @shlomif

fglock commented 9 years ago

I've found that the Exporter.pm module in Perlito5 is not working properly.

Compiling the Solitaire modules one by one, I've got this message from Getopt::Long -

Global symbol "$REQUIRE_ORDER" requires explicit package name at perlito5.pl line 9254.

This is because Perlito's Export can't export scalars yet. In my opinion exporting global variables would be bad practice, but I'll try to fix this anyway.

shlomif commented 9 years ago

@fglock : OK, thanks for returning to me, and your help.

fglock commented 9 years ago

update: I'm currently looking at how to implement this in js:

${$linkage{$opt}} # Getopt::Long line 538

it would work for globals, but js can't (easily) lookup lexicals by name

fglock commented 9 years ago

debugging a bit more - there is no problem with line 538. the actual problem is:

local ($^W) = 0; # line 294

this is not implemented yet.

shlomif commented 9 years ago

@fglock: thanks for the headsup. Please let me know if I can help in any way.

pmurias commented 9 years ago

can't js lookup lexicals by name using eval?

2014-10-16 22:57 GMT+02:00 Shlomi Fish notifications@github.com:

@fglock https://github.com/fglock: thanks for the headsup. Please let me know if I can help in any way.

— Reply to this email directly or view it on GitHub https://github.com/fglock/Perlito/issues/20#issuecomment-59429281.

shlomif commented 9 years ago

@pmurias : that's not the problem - see @fglock ’s other comment.

fglock commented 9 years ago

The script "expand-solitaire-multi-card-moves" compiles now, it produces 472k of javascript.

Still, it fails at runtime because of an "/x" regex, which perlito doesn't transform to js yet.

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

2014-10-17 8:00 GMT+02:00 Shlomi Fish notifications@github.com:

@pmurias https://github.com/pmurias : that's not the problem - see @fglock https://github.com/fglock ’s other comment.

— Reply to this email directly or view it on GitHub https://github.com/fglock/Perlito/issues/20#issuecomment-59469792.

shlomif commented 9 years ago

@fglock: thanks! I got your message and will try it later. This is just an ack.

fglock commented 6 years ago

I've tried again with the latest build, and this still doesn't run in nodejs - there are still problems with "Getopt/Long.pm" and "Class/XSAccessor.pm":

  $ perl perlito5.pl -Cjs -I src5/lib/ -IGames-Solitaire-Verify-0.1203/lib Games-Solitaire-Verify-
  0.1203/script/expand-solitaire-multi-card-moves
  Can't call method "overload::OVERLOAD" on an undefined value at overload.pm line 2873.
   at Getopt/Long.pm line 3060
  $ nodejs perlito5.js -I src5/lib/ -IGames-Solitaire-Verify-0.1203/lib Games-Solitaire-Verify-
  0.1203/script/expand-solitaire-multi-card-moves
  Can't locate Class/XSAccessor.pm in @INC (@INC contains src5/lib/ Games-Solitaire-Verify-
  0.1203/lib). at Games/Solitaire/Verify/Base.pm line 51