fglock / Perlito

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

Getting started? Errors with perl5 #55

Closed abelard12 closed 6 years ago

abelard12 commented 6 years ago

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!

fglock commented 6 years ago

Thank you for reporting the problem, I've uploaded version 9.027 with the fixes.

You can also get the latest code from github - https://github.com/fglock/Perlito

This is the expected output from the code in Synopsis:


$ perl -I Perlito5-9.027/lib syn.pl

Syntax Tree:

$VAR1 = [

      bless( {

               'code' => 'print',

               'namespace' => '',

               'arguments' => [

                                bless( {

                                         'buf' => 'hello, World!

'

                                       }, 'Perlito5::AST::Buf' )

                              ]

             }, 'Perlito5::AST::Apply' )

    ];

JavaScript source code:

// Do not edit this file - Generated by Perlito5 9.027

var p5want;

var List__ = [];

(function () {

p5pkg["Perlito5::IO"].print("STDOUT", ['hello, World!' + String.fromCharCode(10)]);

})();;


2018-09-03 0:03 GMT+02:00 abelard12 notifications@github.com:

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!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fglock/Perlito/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ1O5IJKOtB0CNcN9fk9P4xaOSF0fP1ks5uXFW3gaJpZM4WWyAu .

fglock commented 6 years ago

version 9.028 in CPAN fixes a problem with the first COOKBOOK example