On May 22, 2007, at 10:05 PM, Patrick R. Michaud wrote:

And I'm really
not sure how to create a Perl6Sub from PIR source code.

We're already doing this in tcl.

See src/class/tclproc.pir for the PIR class which has Sub for a parent class.

runtime/builtin/proc.pir then puts this to use:

  .local pmc pir_compiler
  pir_compiler = compreg 'PIR'

  # (see note on trans_charset in lib/parser.pir) RT#40752:
  $S0 = code
  $I0 = find_charset 'ascii'
  $S0 = trans_charset $I0
  $P0 = pir_compiler($S0)

  # the PIR compiler returns an Eval PMC, which contains each sub that
# was compiled in it. we want the first (and only) one, and we want to
  # put it into a TclProc...
  $P0 = $P0[0]

  $P1 = new 'TclProc'
  assign $P1, $P0

  $P9 = new .String
  $P9 = $S0
  setattribute $P1, 'PIR_source', $P9

Hope this helps.
--
Will "Coke" Coleda
[EMAIL PROTECTED]


Reply via email to