The file consists of a header followed by five tables:
Each table starts with a line containing a decimal count of the items in that table. The count can be zero. The following sections describe the format of table items in each table. In the description, the following terminals are used.
A string is a sequence of letters, digits, and the characters _, ., -, and >. Letters are the Unicode characters a through z and A through Z, and all Unicode characters with encoded values greater than A0 hexadecimal.
An int is an optional minus sign followed by a sequence of digits, 0 to 9.
In the following description, the presence of a space is represented by • and a newline by \n. There are no other spaces between syntactic elements in the file format. Other special characters represent themselves.
header: magic\n module\n magic: limbo .sbl 2.0 module: string
There have been two previous versions of symbol table format, distinguished by the number in magic. Version 1. was the original; version 1.1 added more references back to the source; and version 2.0 replaced the original adt table by a type table and added support for Limbo's pick construction. Only version 2.0 is described here; the others are obsolete.
Module is the name of the module implemented in the Dis file. Symbol file references to identifiers declared by the implementation module are unqualified. A name referenced that is imported from any other module is preceded by m-> where m is that module's identifier.
pc-item: src stmt \n src: pos,pos• pos: file:Os line.Os char file, line, char, stmt: int
A source description src selects source text as a range of characters within lines of a source file. File is an index into the file table (origin 0); line and char are positions within that source file, with line numbers starting at 1 and character positions at 0. If file or line is omitted, it is assumed to have the previous value, or 0 if there is no previous value.
Stmt is the `statement number' of the instruction. Despite its name, the scope of a statement number is smaller than a Limbo statement: it identifies a region marked by the compiler for treatment as a unit when debugging. For instance, in a for statement, the initial expression, increment, test, and body all have unique statement numbers. All instructions compiled from the same region in a Limbo program have the same statement number. The number is that of the innermost region that contains the instruction.
type: @ type-index \n a adt-item p adt-item tag-table t size . id-table m module \n src A type C type F fn-name type L type R type n N B b i f s type-index: int
Each leading character specifies a different Limbo type:
A type-index is an offset in the type table, representing the corresponding type. Size is the size in bytes of a value of the given type. The size of basic types is known and does not appear explicitly: big and real are 64 bits; all others including strings and reference types are 4 bytes. (Strings are represented internally by a pointer.)
Each id-table is preceded by a count of the number of entries, followed by an id-item for each entry in the table:
id-table: count \n id-items id-item: id-offset : id-name : src type \n id-offset: int id-name: string count: int
Id-offset is the number of bytes from the start of the enclosing object to the value of the object identified by id-name.
An adt without a pick clause is described using an adt-item:
adt-item: adt-name • src size \n id-table adt-name: string size: int
The id-table has an entry for every data element of adt-name.
If an adt has a pick clause, the adt's type table entry uses the p type character. The invariant part of the adt is described by an adt-item (with zero size) and the variant clause is described by a tag-table of the following form:
tag-table: count \n tag-items tag-item: name : src size \n id-table | name : src \n
The tag-table describes the variants of a Limbo adt that includes a pick clause. The name is the pick tag for the associated alternative. If the size and id-table are missing, the given variant has the same description as the previous one.
A tuple's id-table contains id-names of the form tn, where n is the 0-origin index of the item in the tuple.
Src is as previously defined above in the PC table section.
fn-item: fn-pc : fn-name \n args locals return fn-pc: int fn-name: string args, locals: id-table return: type
Fn-pc is the starting pc for the Dis instructions for fn-name. If the function is a member of an adt, the member name is qualified by the adt name, so that fn-name has the form `adt-name.member-name'. Within the id-tables for args and locals, the id-offset fields give offsets relative to the function's activation frame. Furthermore, no table entries are made for args that are declared nil (unused).
|SBL(6 )||Rev: Tue Mar 31 02:42:38 GMT 2015|