<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 12/05/2010 11:35 AM, YC wrote:
<blockquote
cite="mid:AANLkTi=UpKU+Dk-_USt7BEqr3JTw89NdcuxsxUHcKCSb@mail.gmail.com"
type="cite">
<meta charset="utf-8">
Hi all -
<div><br>
</div>
<div>continuing on the metacircular interpreter topic - I am now
moving into creating a macro parser, but quickly realize the
disproportionate effort required (compared to the effort so far)
to come up with a macro parser for something like syntax-rules.
Specifically, it seems that matching for nested ellipses is
quite hard to get right, and I have not gotten to the hygiene
portion yet, which appears to mean that I need my own syntax
objects that have the same symbol but are different (and yet
will resolve down lexically for ids that are in the head
position). </div>
<div><br>
</div>
<div>Are there anyone who can share experiences on how to go about
this "easily"? Thanks,</div>
</blockquote>
<br>
Attached is a simple macro expander (but not hygienic) that follows
the algorithm laid out in the paper "Macro by Example" by Wand and
others. Its written in python but the code follows the paper
reasonably close so maybe you can understand it. The paper is on the
acm digital library if you can load it (but for some reason its not
loading for me right now, so here is a google search link to it).<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3A%2F%2Fportal.acm.org%2Fcitation.cfm%3Fid%3D41632&ei=u9z7TPWCMY76sAO__MD3DQ&usg=AFQjCNGnasAUQsGpiVJik29wZRUwHBnz1w">http://www.google.com/url?sa=t&source=web&cd=1&ved=0CBgQFjAA&url=http%3A%2F%2Fportal.acm.org%2Fcitation.cfm%3Fid%3D41632&ei=u9z7TPWCMY76sAO__MD3DQ&usg=AFQjCNGnasAUQsGpiVJik29wZRUwHBnz1w</a><br>
<br>
It looks like you can follow a paper by Dybvig on how to implement
hygiene correctly.<br>
<a class="moz-txt-link-freetext" href="http://www.cs.indiana.edu/~dyb/pubs/bc-syntax-case.pdf">http://www.cs.indiana.edu/~dyb/pubs/bc-syntax-case.pdf</a><br>
</body>
</html>