develooper Front page | perl.perl6.compiler | Postings from March 2005

Re: pugscc --runparrot -e "'Hello, Parrot'.say"

Thread Previous | Thread Next
Leopold Toetsch
March 26, 2005 08:21
Re: pugscc --runparrot -e "'Hello, Parrot'.say"
Message ID:
Autrijus Tang <> wrote:

> As of Pugs revision 1024, this works:

>     % pugscc --runparrot -e "'Hello, Parrot'.say"

I had a look at the generated mandel.imc. Remarkable, how compact
Parrot.hs is and what it already does.

Some remarks:

1) s__z = s__t     # mandel.imc:149

This aliases the two PMCs, it's specifically not an assignement.

  set Px, Py       # PREG(1) = PREG(2);

both PMC registers point to the same thing then.

Replacing it with:

  s__z = clone s__t	# new s__z PMC


  s__z = assign s__t    # existing s__z has now value of s__t

produces the correct mandel image output. PIR should probably provide
some shortcut for the latter.

2) Parrot understands two forms of source line comments:

a) C-like:   #line "file" line
b) opcodes:  setfile "file"
             setline line

See imcc/imcc.l:136 ff

Both are still ignored, but the plan is of course, to get the
information into PBC's meta-data similar to the current PIR line

3) the "last" Continuations

If they are necessary, they should be created outside of the loop. That
needs of course some name mangling, like it's done for labels. I changed
all the continuation usage to plain gotos, which works fine too.

4) substr shortut

For string registers, bracketed access produces a substr

  $S0 = " .:,;..."
  $S1 = $S0[2]

String PMCs support this equally:

  $P0 = new PerlString
  $P0 = " .:,;..."
  $P1 = $P0[2]


  $P2 = new PerlUndef
  $P2 = 2
  $P1 = $P0[$P2]

But PMC versions of most of the string functions are missing.

Parrot will provide eventually methods:

  $P1 = $P0."__substr"(Pstart, Plen, Preplace)
  $P1 = $P0."__substr"(Pstart, Plen)
  $P1 = $P0."__substr"(Pstart)

Please let us know, what else is needed in the near future.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About