Autrijus Tang <[EMAIL PROTECTED]> 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.
It's:

  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

or

  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
information.

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]

or:

  ...
  $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.

Thanks,
leo

Reply via email to