Yukihiro Matsumoto (matz / ruby-lang.org) wrote:
> 
> If you tell me the problem you want to solve, we can seek for the
> solution. 
> 

In YAML, references are kept through an ANCHOR/ALIAS system.  Consider
the following:

  - &ref Referenced text
  - *ref

When I parse `&ref', I create an entry in an anchors table.  The anchors
table is equivalent to Marshal's load_arg.symbol table.  In the table, I
map anchor names and VALUEs.  In Python, I map anchor names and PyObject
pointers.

The problem is YAML like this:

  - &a [*a, *a]

As I'm using an LALR grammar, the ALIAS `*a' gets parsed before the
ANCHOR `&a'.  So `*a' will be a BadAlias node when `&a' gets parsed.

So I store the BadAlias VALUE in my anchors table.  Then, when I get to `&a',
I copy the correct node into the BadAlias's spot.  I should probably
swap the two, actually, to ensure they both get freed properly.

That's the state of things.  Thanks, matz.

_why