Version 7 (modified by coke, 5 years ago)


Put your requests for documentation for NQP-rx (the new flavor of NQP) here.

  • Looping constructs
    19:50:32 < cconstantine> How would I loop through an iterable backwards in NQP?
    19:50:52 <@dukeleto> cconstantine: code sample?
    19:51:28 < cconstantine> In an action for my gramar I want to loop through the child nodes backwards
    19:52:02 < cconstantine> rule cons { [<term> ]* {*}}  <---- loop through the <term>s backwards
my $n := +$<term> - 1;
while $n >= 0 { 
    # do something with $<term>[$n] here
    $n := $n - 1;
  • A basic tutorial for HLL implementers that starts from step 1 of using and ends with some new type of builtin implemented and a custom Configure-time check being added to the build process in the new HLL. Basically, an updated squawk tutorial, but perhaps shorter and easier to get into.

nqp-rx abandons altogether. We'll probably come up with a new one. Yes, we need a full-on tutorial, I just haven't had time to write it. It would help to know a language to use as a tutorial example.

  • How do I use threads in NQP?

How does one use threads in Parrot? (This isn't meant to be glib -- before I can explain how to use threads in NQP, I need to know how one can use them in Parrot. --Pm)

  • How do I use PIR from NQP?

One can either use the PIR opcodes directly with pir::opcode($args), or one can substitute long sequences of PIR using Q:PIR { ... }.

when invoking a single opcode, you can coerce the argument types with STUFF, where stuff is a single letter per opcode arg, with the key:

I = int register
N = num register
n = num register or numeric constant
i = int register or integer constant
S = string register
s = string register or string constant
P = pmc register
* = anything
~ = string register, string constant, or PMC
+ = anything numeric
v = void