Dan Sugalski:
# =item Add source code to segment
#
# This adds a line or more of source code to the bytecode segment.
Optional?
# =item Add AST to segment
#
# This adds the AST for some of the source code to the bytecode segment.
Optional?
# =item Add line number information
#
# This adds line number info to the bytecode segment, allowing
# the interpreter to find out what line of source a particular
# piece of bytecode corresponds to.
Optional?
# =item Add bytecode to segment
#
# Add in actual bytecode to the segment.
Not optional. :^)
# =item Add constants (string, PMC, and float)
#
# Add one or more constants to the bytecode constant pool
#
# =item Add symbols to segment
#
# Add in symbolic information to the bytecode segment,
# including exported variables, classes, and functions
Optional?
# =item Add binary data chunk to segment
#
# Add in some raw binary data to the bytecode segment
Optional?
Can you have multiple raw chunks? Can they have symbolic names?
Symbolic type names?
Are the other chunks essentially subclasses of this one?
Is there some kind of directory that tells you stuff about these chunks?
If there is, I can imagine two basic formats:
SEGMENT 1
DIRECTORY
CHUNK 1
OFFSET: 100 (4 bytes)
SIZE: 55 (4 bytes)
NAME: "src" (7 bytes)
TYPE: "Parrot::Source Code" (23 bytes)
CHUNK 2
OFFSET: 155
SIZE: 524
NAME: "bc"
TYPE: "Parrot::Bytecode"
...
CHUNK 1
use strict;
use warnings;
print "Hello World!\n";
exit;
CHUNK 2
101011101...
Or
SEGMENT 1
DIRECTORY
CHUNK 1 OFFSET: 100
CHUNK 2 OFFSET: 189
CHUNK 1:
SIZE: 55
NAME: "src"
TYPE: "Parrot::Source Code"
DATA: ...
CHUNK 2:
SIZE: 524
NAME: "bc"
TYPE: "Parrot::Bytecode"
DATA: ...
--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)
Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
--Albert Einstein (explaining radio)