Hi, Fis Trivial <ybbs.da...@hotmail.com> writes: > Can you give me some guidance for how to achieve the goal(record all > source information for every symbol). If it's theoretically impossible > or hard to achieve, can you give me some inside why and advises for > making best effort? I intend to help, so pointers to internal structures > are also welcomed.
The problem is that there's no place to store the source information for symbols in the standard S-expression representation. The principal defining characteristic of symbols -- that "two symbols are identical (in the sense of 'eqv?') if and only if their names are spelled the same way" (R5RS ยง 6.3.3) -- combined with the fact that 'eq?' is specified to be the same as 'eqv?' for symbols, leaves us no way to distinguish two instances of the same symbol, and therefore no way to store per-instance annotations such as source information. Fixing this would require abandoning the plain S-expression representation in favor of one in which symbols are represented by a different data structure. Our reader would need to be extended to support the option of returning this new data representation instead of plain S-expressions, and our macro expander would need to be modified to accept this new representation as input. Mark