[plt-scheme] How to use syntax case?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon May 28 16:37:05 EDT 2007


>> I'm starting with syntax case from zero. My end goal is to read a file 
>> and extract a definition by name, for example "define impl1" so that I 
>> can include it in another document.

Hi Grant,


DivaScheme does a little bit of this, although it's not too documented.

http://planet.plt-scheme.org/package-source/divascheme/divascheme.plt/1/1/stags-lib.ss

The function "find-defs-in-stx" and all its helper functions use 
syntax-case* to pick out the definition identifiers.  You may be able to 
look at it for some inspiration.


The Scheme Cookbook had a few good pointers to syntax-rules/syntax-case 
stuff that is also helpful:

http://schemecookbook.org/view/Cookbook/GettingStartedMacros


Good luck!


Posted on the users mailing list.