On the ROMs page of my petindex site (
http://www.6502.org/users/andre/petindex/roms.html) you find links to the disassemblies of the PET ROMs as well as a memory map for the BASIC4.
The BASIC stores the text and variables in separate sections. First is the basic text, then come the basic variables as an array, then the basic arrays.
The strings on the other hand are stored from the end of the available memory down. When the string area reaches the array area a string garbage collection is done.
Code:
TXTTAB 0028-0029 40-41 Pointer: Start of BASIC Text
VARTAB 002A-002B 42-43 Pointer: Start of BASIC Variables
ARYTAB 002C-002D 44-45 Pointer: Start of BASIC Arrays
STREND 002E-002F 46-47 Pointer End of BASIC Arrays (+1)
FRETOP 0030-0031 48-49 Pointer: Bottom of String Storage
FRESPC 0032-0033 50-51 Utility String Pointer
MEMSIZ 0034-0035 52-53 Pointer: Highest Address Used by BASIC
BTW: In this (German) article
http://www.heise.de/newsticker/meldung/61292/ about Microsoft's birthday there is a link to a scan of a document describing the original MS Basic storage layout, by Bill Gates. You will recognize what you see :)
Concerning your "Loading" or "Saving" PET programs on the PC. BASIC only stores the basic text, i.e. TXTTAB-VARTAB. All variables are created on runtime.
After loading the BASIC recalculates the line links between the basic lines ("pointer to next line" in B.Gates description). At least it does for the C64, not sure about the PET.
Not sure what exactly you want to achieve.
André