This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: macro problem
- From: Per Bothner <per at bothner dot com>
- To: kawa at sourceware dot org
- Date: Wed, 03 Dec 2014 14:37:52 -0800
- Subject: Re: macro problem
- Authentication-results: sourceware.org; auth=none
- References: <547F6FE6 dot 4020002 at hungry dot com>
On 12/03/2014 12:17 PM, Seth Alves wrote:
I'm trying to run ssax with Kawa. It's getting hung up during macro
expansion -- it will either hang or exit with an error:
self-referential (cyclic) syntax template
I've tried to boil it down to a small example, but this is the best
I've gotten. This doesn't do anything useful, but other schemes
accept it. Should it load in Kawa or is there actually something
wrong with it?
I didn't try to really understand what was going on. However,
my hunch was that the problem wasn't actually a cycle, but rather
sharing: The same list fragment showed up multiple times in the
(macro-generated) template. Fixing that was fairly simple:
We just need to not only 'put' this current Pair into the 'seen'
table before recursing - but we also need to 'remove' it when done.
I checked this change in.
It should be possible to handle actual cycles in the template.
translating it to a template program that builds a cyclic result.
However, that seems more trouble than it's worth.
--
--Per Bothner
per@bothner.com http://per.bothner.com/