nanopass-framework-racket icon indicating copy to clipboard operation
nanopass-framework-racket copied to clipboard

Support for DrRacket arrows and renaming

Open soegaard opened this issue 9 years ago • 4 comments

After syntax checking DrRacket supports some nice features:

  • Hovering over an identifier shows an arrow to its binding
  • Rightclicking an identifier allows (lexical scope aware) renaming of identifiers All identifiers with the same binding are renamed.

Consider this program:

#lang nanopass
(define-language L
  (entry Expr)
  (terminals (number (r)))
  (Expr (e) r))

(with-output-language (L Expr) 1)

I would like to rename L but the renaming option is not available. In order to support renaming one has to add properties:

http://docs.racket-lang.org/tools/Check_Syntax.html?q=sub-binder#%28idx._%28gentag.28.%28lib._scribblings%2Ftools%2Ftools..scrbl%29%29%29

Note that if the property 'sub-range-binders is used then a renaming of L to M will also rename unparse-L to the unparse-M.

soegaard avatar Jul 09 '15 15:07 soegaard

Yes, I am all up for adding these properties.

Although this does lead to the question of do we want to continue to strip the ? off of predicates in terminals?

(If we stop stripping them off we do get support for the arrows. Although if we don't, then we can just add the check syntax property's back.)

After playing with it a bit both ways I'm pretty ambivalent as it hasn't made much of an impact either way. Although whenever I describe nanopass to other people who have used racket they have complained to me about that.

LeifAndersen avatar Jul 11 '15 21:07 LeifAndersen

2015-07-11 23:26 GMT+02:00 Leif Andersen [email protected]:

Yes, I am all up for adding these properties.

Although this does lead to the question of do we want to continue to strip the ? off of predicates in terminals?

(If we stop stripping them off we do get support for the arrows. Although if we don't, then we can just add the check syntax property's back.)

Both would work.

After playing with it a bit both ways I'm pretty ambivalent as it hasn't made much of an impact either way. Although whenever I describe nanopass to other people who have used racket they have complained to me about that.

Complained about which part?

/Jens Axel

soegaard avatar Jul 12 '15 15:07 soegaard

Complained about which part?

Complained about the question marks disappearing. (They would rather the full predicate be there.) So it would look like:

(define-language L0 (terminals (symbol? (x))))

Although I'm good either way.

Anyway, PR# 31 does deal with this issue. Although I wouldn't close it just yet. (As there is likely more arrows we wish to have.)

LeifAndersen avatar Jul 13 '15 22:07 LeifAndersen

@LeifAndersen Is it time to close it?

soegaard avatar Jan 23 '22 13:01 soegaard