[racket] examples of hooking a #lang into DrRacket?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Jul 14 03:53:55 EDT 2014

The most relevant section of the documentation is

  http://docs.racket-lang.org/guide/language-get-info.html


The Scratchy language is intended to be an example:

  https://github.com/mflatt/scratchy


You could also check "reader.rkt" as part of

 http://queue.acm.org/downloads/2011/racket/6-color/README.txt
 http://queue.acm.org/downloads/2011/racket/6-color/txtadv.rkt
 http://queue.acm.org/downloads/2011/racket/6-color/world.rkt
 http://queue.acm.org/downloads/2011/racket/6-color/lang/color.rkt
 http://queue.acm.org/downloads/2011/racket/6-color/lang/reader.rkt

which is from "Creating Languages in Racket" in "Queue". The
"reader.rkt" module has the relevant part at the end:

 ;; DrRacket asks `get-info' for a 'color-lexer module:
 (require racket/runtime-path)
 (define-runtime-path color-lexer-path "color.rkt")
 (define (get-info in mod line col pos)
   (lambda (key default)
     (case key
       [(color-lexer)
        (dynamic-require color-lexer-path 'color-lexer)]
       [else default])))

The Scratchy example is more recent and I think better organized,
though.


At Mon, 14 Jul 2014 00:18:27 -0700, Matthew Butterick wrote:
> Pollen source files run fine in DrRacket. But the `#lang pollen` line shows up 
> as red (though no error is reported in the bottom of the window) and no toolbar 
> buttons are available. So something is not quite right.
> 
> I gather that this has something to do with telling DrRacket about 
> language-specific capabilities. [1]
> 
> However, many of the custom #langs in Racket use the standard #lang s-exp 
> syntax/module-reader, which seems to eliminate these problems from the start.
> 
> Q: To supplement the documentation, are there particular #langs that show 
> examples of this kind of configuration file?
> 
> [1] 
> http://docs.racket-lang.org/tools/Language-Specific_Capabilities.html?q=Customiz
> ing%20DrRacket%u2019s%20Behavior


Posted on the users mailing list.