Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problems with $?LANG.refine_slang actions role # updated title to reflect the remaining problems #2404

Open
cognominal opened this issue Oct 20, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@cognominal
Copy link
Contributor

commented Oct 20, 2018

context

In an attempt to write a slang to parse NQP/Perl 6 code and rewrite code that generates QAST tree so
as to generate code in another slang, I ran into problems trying to derive new actions.
This bug report deals with Perl 6 even if my problem is dealing with nqp code because this is the place
where QAST trees are generated. I commented the necessary code that could generate further problems
but would be necessary for my endeavor.
I will file a NQP bug as well.

The Code

  # use nqp;
  # use QAST:from<NQP>;
  BEGIN $*LANG.refine_slang: 'MAIN', role {},
   role {
      method methodop($/) {
  #         say($/);
  #        callsame;
       }
   };

  5.say;
 # QAST::IVal.new(:value(666));

The error message

perl6 --ll-exception ast.p6
Type check failed in binding to parameter '$/'; expected Any but got Perl6::Grammar+{<anon|1>} (Perl6::Grammar+{<anon|1>}.new() #`[14012539687...)
at SETTING::src/core/Exception.pm6:57 (/usr/local/share/perl6/runtime/CORE.setting.moarvm:throw)
from SETTING::src/core/Exception.pm6:2726 (/usr/local/share/perl6/runtime/CORE.setting.moarvm:)
from gen/moar/BOOTSTRAP.nqp:326 (/usr/local/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:)
from gen/moar/BOOTSTRAP.nqp:3691 (/usr/local/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:)
from ast.p6:5 (:methodop)
from gen/moar/stage2/QRegex.nqp:1654 (/usr/local/share/nqp/lib/QRegex.moarvm:!reduce)
from gen/moar/stage2/QRegex.nqp:1597 (/usr/local/share/nqp/lib/QRegex.moarvm:!cursor_pass)
from gen/moar/Perl6-Grammar.nqp:4377 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:methodop)
from gen/moar/Perl6-Grammar.nqp:4352 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:dottyop)
from :1 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:dotty:sym<.>)
from gen/moar/stage2/QRegex.nqp:1694 (/usr/local/share/nqp/lib/QRegex.moarvm:!protoregex)
from :1 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:dotty)
from gen/moar/Perl6-Grammar.nqp:4230 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:postfixish)
from gen/moar/Perl6-Grammar.nqp:4137 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:termish)
from gen/moar/stage2/NQPHLL.nqp:985 (/usr/local/share/nqp/lib/NQPHLL.moarvm:EXPR)
from gen/moar/Perl6-Grammar.nqp:4163 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:EXPR)
from gen/moar/Perl6-Grammar.nqp:1452 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:statement)
from gen/moar/Perl6-Grammar.nqp:1380 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:statementlist)
from gen/moar/stage2/NQPHLL.nqp:1217 (/usr/local/share/nqp/lib/NQPHLL.moarvm:LANG)
from gen/moar/Perl6-Grammar.nqp:1828 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:FOREIGN_LANG)
from gen/moar/Perl6-Grammar.nqp:1344 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:comp_unit)
from gen/moar/Perl6-Grammar.nqp:553 (/usr/local/share/nqp/lib/Perl6/Grammar.moarvm:TOP)
from gen/moar/stage2/QRegex.nqp:2301 (/usr/local/share/nqp/lib/QRegex.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:2021 (/usr/local/share/nqp/lib/NQPHLL.moarvm:parse)
from gen/moar/stage2/NQPHLL.nqp:1937 (/usr/local/share/nqp/lib/NQPHLL.moarvm:execute_stage)
from gen/moar/stage2/NQPHLL.nqp:1970 (/usr/local/share/nqp/lib/NQPHLL.moarvm:run)
from gen/moar/stage2/NQPHLL.nqp:1973 (/usr/local/share/nqp/lib/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:1959 (/usr/local/share/nqp/lib/NQPHLL.moarvm:compile)
from gen/moar/stage2/NQPHLL.nqp:1657 (/usr/local/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1914 (/usr/local/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1837 (/usr/local/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/usr/local/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1763 (/usr/local/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:54 (/usr/local/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:42 (/usr/local/share/perl6/runtime/perl6.moarvm:)
from :1 (/usr/local/share/perl6/runtime/perl6.moarvm:

)
from :1 (/usr/local/share/perl6/runtime/perl6.moarvm:)

Actual Behavior

Steps to Reproduce

Environment

  • Operating system:
    Linux ubu2 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

  • Compiler version (perl6 -v):
    This is Rakudo version 2018.09-447-gc8438e6af built on MoarVM version 2018.09-131-g1d6562bfd
    implementing Perl 6.c.

@niner

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2018

Please try method methodop(Mu $/) {

@cognominal

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2018

The associated problem in nqp : perl6/nqp#509

@cognominal

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2018

Thx.
With methodop(Mu $/) { I get a problem with the optimizer. Not investigated it yet.

Variable '&postfix:<.>' is not declared
at SETTING::src/core/Exception.pm6:57 (/usr/local/share/perl6/runtime/CORE.setting.moarvm:throw)
from gen/moar/Perl6-Optimizer.nqp:392 (/usr/local/share/nqp/lib/Perl6/Optimizer.moarvm:report)
from gen/moar/Perl6-Optimizer.nqp:926 (/usr/local/share/nqp/lib/Perl6/Optimizer.moarvm:optimize)
from src/Perl6/Compiler.nqp:47 (/usr/local/share/nqp/lib/Perl6/Compiler.moarvm:optimize)
from gen/moar/stage2/NQPHLL.nqp:1937 (/usr/local/share/nqp/lib/NQPHLL.moarvm:execute_stage)
from gen/moar/stage2/NQPHLL.nqp:1970 (/usr/local/share/nqp/lib/NQPHLL.moarvm:run)
from gen/moar/stage2/NQPHLL.nqp:1973 (/usr/local/share/nqp/lib/NQPHLL.moarvm:)
from gen/moar/stage2/NQPHLL.nqp:1959 (/usr/local/share/nqp/lib/NQPHLL.moarvm:compile)
from gen/moar/stage2/NQPHLL.nqp:1657 (/usr/local/share/nqp/lib/NQPHLL.moarvm:eval)
from gen/moar/stage2/NQPHLL.nqp:1914 (/usr/local/share/nqp/lib/NQPHLL.moarvm:evalfiles)
from gen/moar/stage2/NQPHLL.nqp:1837 (/usr/local/share/nqp/lib/NQPHLL.moarvm:command_eval)
from src/Perl6/Compiler.nqp:42 (/usr/local/share/nqp/lib/Perl6/Compiler.moarvm:command_eval)
from gen/moar/stage2/NQPHLL.nqp:1763 (/usr/local/share/nqp/lib/NQPHLL.moarvm:command_line)
from gen/moar/main.nqp:54 (/usr/local/share/perl6/runtime/perl6.moarvm:MAIN)
from gen/moar/main.nqp:42 (/usr/local/share/perl6/runtime/perl6.moarvm:)
from :1 (/usr/local/share/perl6/runtime/perl6.moarvm:

)
from :1 (/usr/local/share/perl6/runtime/perl6.moarvm:)

But like I said, in the given context, I don't care much about $*LANG.refine_slang in Perl 6 but I do care in nqp even if I understand it has probably be written with Perl 6 in mind.

@zoffixznet

This comment has been minimized.

Copy link
Contributor

commented Oct 20, 2018

IIRC $*LANG is the obsoleted one and you're meant to use $?LANG now.

@cognominal cognominal changed the title type problem with $*LANG.refine_slang actions role problems with $?LANG.refine_slang actions role # updated title to reflect the remaining problems Oct 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.