Re: [racket-users] using a created language in the repl

2017-05-28 Thread Vityou
I think what happens is that when you use the language with the repl it ignores 
the reader and just looks at the exports from the language (main.rkt).

On Thursday, May 25, 2017 at 10:14:58 AM UTC-6, Dmitry Pavlov wrote:
> Vityou,
> 
> 
> 
> I will give you an example though I myself sometimes doubt that I
> did it in the right way.
> 
> 
> 
> Anyway, here is what I did when I had exactly the same problem:
> 
> 
> 
> - redefine and reexport #%
> 
> top-interaction
> 
> - provide #:language-info to the DrRacket's REPL (I am not sure if
> racket's REPL needs it too, but doing it will not hurt). The
> provided call should respond to 'configure-runtime key 
> 
> - the 'configure-runtime should trigger a setting of
> (current-read-interaction) parameter.
> 
> - at the end of the implementation of (current-read-interaction), it
> should set another (current-read-interaction) that just returns EOF
> -- and then sets the original (current-read-interaction) back, so it
> is kind of a loop.
> 
> 
> 
> The example (made long ago) is available at:
> https://github.com/kugelblitz/calc
> 
> 
> 
> Relevant parts:
> 
> /language.rkt (see top-interaction)
> 
> /lang/reader.rkt (reference to lang-info)
> 
> /lang/lang-info.rkt (calling of "configure runtime" handler)
> 
> /lang/configure-runtime.rkt (the handler itself)
> 
> 
> 
> Hope this helps.
> 
> 
> 
> Dmitry
> 
> 
> 
> 
> 
> 
> 
> 
> On 05/18/2017 06:45 AM, Vityou wrote:
> 
> 
> 
>   I did reprovide all of the #%... forms from racket, and the repl works 
> with base.rkt, it's when I have a reader that the repl doesn't work.

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] using a created language in the repl

2017-05-25 Thread Dmitry Pavlov

Vityou,

I will give you an example though I myself sometimes doubt that I did it in the 
right way.

Anyway, here is what I did when I had exactly the same problem:

- redefine and reexport #% top-interaction
- provide #:language-info to the DrRacket's REPL (I am not sure if racket's 
REPL needs it too, but doing it will not hurt). The provided call should 
respond to 'configure-runtime key
- the 'configure-runtime should trigger a setting of (current-read-interaction) 
parameter.
- at the end of the implementation of (current-read-interaction), it should set 
another (current-read-interaction) that just returns EOF -- and then sets the 
original (current-read-interaction) back, so it is kind of a loop.

The example (made long ago) is available at: https://github.com/kugelblitz/calc

Relevant parts:
/language.rkt (see top-interaction)
/lang/reader.rkt (reference to lang-info)
/lang/lang-info.rkt (calling of "configure runtime" handler)
/lang/configure-runtime.rkt (the handler itself)

Hope this helps.

Dmitry



On 05/18/2017 06:45 AM, Vityou wrote:

I did reprovide all of the #%... forms from racket, and the repl works with 
base.rkt, it's when I have a reader that the repl doesn't work.



--
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] using a created language in the repl

2017-05-17 Thread Vityou
I did reprovide all of the #%... forms from racket, and the repl works with 
base.rkt, it's when I have a reader that the repl doesn't work.

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] using a created language in the repl

2017-05-17 Thread Alex Knauth

> On May 17, 2017, at 8:30 PM, Vityou  wrote:
> 
> I made a little lambda-calculus language and it works for everything, except 
> when I try to use it in the repl: racket -I lambda-calculus.  It acts like it 
> worked, but when I try to type an expression it says that all the variables 
> like #%top-interaction don't exist.  I made a pure language and a base (that 
> just adds some stuff to pure) language, and in the main.rkt file, I made a 
> reader submodule that just uses the base language: (module reader 
> syntax/module-reader
>  "base.rkt")
> 
> The repl works with lambda-calculus/base and pure, but not plain 
> lambda-calculus.  Plain lambda-calculus works in the drracket interactions 
> area, so I don't know why it won't work in the repl.

In general it depends on whether you need to change the reader or not. However 
from your reader module it looks like you're using the default reader, so most 
likely just re-providing racket's #%top-interaction from "base.rkt" will work.

Alex Knauth

-- 
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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.