[Parrot-users] Documentation Issue

Jonathan "Duke" Leto jonathan at leto.net
Wed Jan 18 17:07:31 UTC 2012


Howdy,

I pushed a fix for this to parrot.git this morning. Thanks!

Duke

On Wed, Jan 18, 2012 at 4:13 AM, John Rizzo <johnrizzo1 at gmail.com> wrote:
> When I was trying to walk through the examples for implementing the
> instructional language squaak I ran into an error.
>
> Symbol '$S0' not predeclared in statement:sym<try>
>
> If I change the method statement:sym<try> where it declares $pir to use "'"
> characters intead of '"' characters for the quote it works.  I didn't see
> anywhere I could submit a patch or open a bug so I'm hoping someone can
> update the doc for the next person who walks through them.  My working
> version is as follows;
>
>  method statement:sym<try>($/) {
>      ## get the try block
>      my $try := $<try>.ast;
>
>      ## create a new PAST::Stmts node for
>      ## the catch block; note that no
>      ## PAST::Block is created, as this
>      ## currently has problems with the
>      ## exception object. For now this will
>      ## do.
>      my $catch := PAST::Stmts.new( :node($/) );
>      $catch.push($<catch>.ast);
>
>      ## get the exception identifier;
>      ## set a declaration flag, the scope,
>      ## and clear the viviself attribute.
>      my $exc := $<exception>.ast;
>      $exc.isdecl(1);
>      $exc.scope('lexical');
>      $exc.viviself(0);
>      ## generate instruction to retrieve the exception object (and the
>      ## exception message, that is passed automatically in PIR, this is
> stored
>      ## into $S0 (but not used).
>      my $pir := '    .get_results (%r, $S0)\n'
>               ~ "    store_lex '" ~ $exc.name()
>               ~ "', %r";
>
>      $catch.unshift( PAST::Op.new( :inline($pir), :node($/) ) );
>
>      ## do the declaration of the exception object as a lexical here:
>      $catch.unshift( $exc );
>      make PAST::Op.new( $try, $catch, :pasttype('try'), :node($/) );
>  }
>
>
> It may be the case that I'm doing something wrong and it should in fact not
> be changed.  If so please let me know so I can figure out what I'm doing.
>
> Thanks
>
> John Rizzo
> johnrizzo1 at gmail.com
>
> _______________________________________________
> Parrot-users mailing list
> Parrot-users at lists.parrot.org
> http://lists.parrot.org/mailman/listinfo/parrot-users
>



-- 
Jonathan "Duke" Leto <jonathan at leto.net>
Leto Labs LLC
209.691.DUKE // http://labs.leto.net
NOTE: Personal email is only checked twice a day at 10am/2pm PST,
please call/text for time-sensitive matters.


More information about the Parrot-users mailing list