[gambit-list] print parse tree

Marc Feeley feeley at iro.umontreal.ca
Thu Oct 22 12:08:32 EDT 2009

On 2009-10-22, at 11:57 AM, Nguyen Thai Ngoc Duy wrote:

> Hi,
> How can I print a parse tree, generated by parse-program from
> _front.scm? I don't know the underlying structure but REPL prints the
> result for ever, like printing a circular graph.

The problem is that the parse tree nodes have a "parent" pointer, and  
this introduces cycles.  The structure, defined in gsc/_ptreeadt.scm  
would have to be turned into a real structure with a "define-type",  
and the "parent" field marked as unprintable: .  Alternatively, you  
could set the readtable so that shared structures are indicated with  
the #n=... syntax.  Also, if you only care about the S-expression  
which corresponds to a parse tree "x", call (parse-tree->expression x).

> BTW, igsc.scm is broken because _t-c-2.scm needs
> targ-obj-subtype-integer from -t-c-3.scm.

OK.  I'll fix this.


More information about the Gambit-list mailing list