Hello everyone! Just wanted to announce a neat project I've been working 
on: Resyntax <https://github.com/jackfirth/resyntax/>, a tool for 
refactoring racket code. Currently the tool is able to replace various uses 
of `let` forms with `define`, as can be seen in this pull request 
<https://github.com/racket/scribble/pull/289>.

The tool works by hooking in to the racket macro expander and applying 
*refactoring 
rules* to the code as it's being expanded, where a refactoring rule is a 
syntax-parse macro that says how to rewrite some code pattern. You can see 
all of the refactoring rules I've implemented so far in the 
resyntax/refactoring-rule 
<https://github.com/jackfirth/resyntax/blob/master/refactoring-rule.rkt> 
module.

Resyntax is in the early stages. It works well enough when run manually on 
single files, and it has some nice features already:

   - Output is correctly indented
   - Rules are hygienic, so Resyntax's rules for replacing `let` with 
   `define` won't run on code where `let` is bound to something other than the 
   `let` from `racket/base`.
   - If a rule leaves a subform untouched, the formatting of that form is 
   left completely unchanged by the tool.

But it's got some issues that need to be worked out:

   - No public API for running it.
   - No documentation on how to create your own refactoring rules.
   - Deletes comments sometimes.
   - Doesn't enforce that code produced by a refactoring rule actually 
   compiles.
   - Current rules are not all that robust yet and may sometimes produce 
   buggy or badly formatted code.
   
If you're interested in following along with Resyntax's development, see 
the github repository <https://github.com/jackfirth/resyntax/>. If you've 
got some suggestions for rules, follow the guidance in this github issue 
<https://github.com/jackfirth/resyntax/issues/8> to tell me all about your 
ideas. And, as usual, I can be reached by email and in the racket Slack and 
Discord servers.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/93f92eb3-00ad-4b59-818a-7848e984f7ecn%40googlegroups.com.

Reply via email to