Dmitry Pavlov | 27 Oct 2011 08:44
Picon
Favicon

Macro stepper?

Hello,

I recently started to program in Racket, and I like Geiser very much.
However, there is a feature DrRacket has that I miss in Geiser:
the Macro Stepper.

I have a custom (non-sexp) language, for which I provide #lang mylang
declaration in my module. Compilation works well, but I actually
need to see how the code in my language expands into Racket macro
forms. DrRacket's "Macro Stepper" button does that perfectly.
Is there something similar for Geiser?

I tried to select the entire buffer and perform Geiser's
"macroexpand region", but it does not work, saying:

   Error: retort-syntax

   UNKNOWN::19310: read: #lang not enabled in the current context

Best regards,

Dmitry

Jose A. Ortega Ruiz | 27 Oct 2011 12:45
Picon
Gravatar

Re: Macro stepper?


Hi Dmitry,

On Thu, Oct 27 2011, Dmitry Pavlov wrote:

> Hello,
>
> I recently started to program in Racket, and I like Geiser very much.
> However, there is a feature DrRacket has that I miss in Geiser: the
> Macro Stepper.

Unfortunately, the stepper is not yet integrated.  I have plans to
integrate it, though.  A first step will be to base Geiser's interaction
with Racket on Eli's xrepl module, which already offers a stepper in the
text REPL.  Once that is working, it'll be time to add a better Emacs
interface....  But you'll have to be patient, submit patches or both :)

> I have a custom (non-sexp) language, for which I provide #lang mylang
> declaration in my module. Compilation works well, but I actually
> need to see how the code in my language expands into Racket macro
> forms. DrRacket's "Macro Stepper" button does that perfectly.
> Is there something similar for Geiser?
>
> I tried to select the entire buffer and perform Geiser's
> "macroexpand region", but it does not work, saying:
>
>   Error: retort-syntax
>
>   UNKNOWN::19310: read: #lang not enabled in the current context

(Continue reading)

Dmitry Pavlov | 28 Oct 2011 08:24
Picon
Favicon

Re: Macro stepper?

Hello Jose,

Thank you for your answer.

>> I tried to select the entire buffer and perform Geiser's
>> "macroexpand region", but it does not work, saying:
>>
>>    Error: retort-syntax
>>
>>    UNKNOWN::19310: read: #lang not enabled in the current context
>
> Try selecting the lines _after_ this line.  You can also try with
> individual definitions first to see if they work (you'll need to compile
> the file first (C-c C-k) so that Racket knows about it).  The macro
> expansions should take place in the context of your #lang, modulo bugs.

Still does not work...
I have the following code

#lang mylang
X := Y.

which expands into the following (I checked in DrRacket):

(module test mylang/language
   (#%module-begin (assign X Y)))

and compiles  well, thanks to the macro in language.rkt:

(define-syntax-rule (assign name value)
(Continue reading)

Jose A. Ortega Ruiz | 28 Oct 2011 13:13
Picon
Gravatar

Re: Macro stepper?


Hi Dmitry,

On Fri, Oct 28 2011, Dmitry Pavlov wrote:

[...]

> Still does not work...
> I have the following code
>
> #lang mylang
> X := Y.

Oh, i see the problem now.  Currently, Geiser is assuming that what
it'll find in a rkt file is regular scheme syntax, and it's wrapping the
non-sexp in a bad way.  I'm afraid proper support for non-sexpy
languages is a bit low in my TODO list, because it'd require some
serious overhaul of parts of Geiser which now are nice and simple, and
i'm not sure the added complexity would pay off.

[...]

>> But you'll have to be patient, submit patches or both
>
> OK, for now I will go with being patient :)

Fair enough :).  Sorry i cannot be of more help for the time being :( If
i can think of a quick hack to make your specific case work, i'll let
you know!

(Continue reading)


Gmane