[plt-scheme] New language plugin: sPico

From: Kim Gybels (kgybels at vub.ac.be)
Date: Sat Nov 20 10:07:10 EST 2004

Hi,

First of all: thanks for the reply.

We already toke a look at the algol language and the java language. We
have a general idea of what the "purpose" of the DrScheme languages
is and we know we could do it like that too. If a tool, however, is
meant for one purpose, doesnt mean you can't abuse it for another one
;)

We found the following work around for are problem.

(let ((result (pico-eval str))
	(datum->syntax-object (syntax result) result))

This makes a syntax object that will evaluate to our string.

On a side note:
Our implementation is getting along very well know. Almost all of the
features we want are ready.
If you ever want to experiment with Pico, I can surely recommend using
the sPico plugin ;)

Just one other thing I was wondering:
is it possible to display an icon where the gc-collect icon is usually
displayed. We need this because the Pico-vm also does garbage
collects, and we want to show this by using a different gc-icon :)

Greetz,

Kim & Toon

On (20/11/04 18:32), Daniel Silva wrote:
> From: Daniel Silva <daniel.silva at gmail.com>
> Subject: Re: [plt-scheme] New language plugin: sPico
> To: Kim Gybels <ryu at igwe.vub.ac.be>
> Cc: plt-scheme at list.cs.brown.edu
> Date: Sat, 20 Nov 2004 18:32:12 +0900
> Message-ID: <a29bac63041120013245b8cae8 at mail.gmail.com>
> 
> I think you're misunderstanding the purpose of DrScheme languages. 
> Right now you grab the input string, parse and evaluate it, and return
> the result of the program as another string.
> What you probably should do is grab the input string, parse it and
> compile it into Scheme code for mzscheme/mred/drscheme to evaluate. 
> You should represent the generated Scheme code as syntax objects --
> that's the data type DrScheme expects from the front-end method.
> Take a look at the algol60 front-end method (in tool.ss) for an
> example, and here's my implementation for Spy:
> 
> (define/public (front-end input settings)
>   ;; first convert 'input' into a normal port
>   (let-values ([(port name)
>                 (if (string? input)
>                     (values (open-input-file input) (path->complete-path input))
>                     (let ([text (drscheme:language:text/pos-text input)])
>                       (values (open-input-string
>                                (send text
>                                      get-text
>                                      (drscheme:language:text/pos-start input)
>                                      (drscheme:language:text/pos-end input)))
>                               text)))])
>     ;; now read and compile the source code into Scheme
>     (let ([ast-list (read-python-port port name)])
>       (close-input-port port)
>       (lambda ()
>         (if (null? ast-list)
>             eof
>             (begin0 (compile-python-ast (car ast-list))
>                     (set! ast-list (cdr ast-list))))))))
> 
> Daniel
> 
> 
> On Thu, 18 Nov 2004 09:11:28 +0100, Kim Gybels <ryu at igwe.vub.ac.be> wrote:
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > 
> > Hi,
> > 
> > We are trying to create a plugin for a language called pico.
> > This actually already works, but we are trying to get rid
> > of a strange error that we always get when we read-eval-print
> > anything. (the program has its own read-eval-print-loop)
> > 
> > The thing we get is the following:
> > 
> > > 5
> > 5
> > eval-syntax: expects argument of type <syntax>; given
> > 
> > Or program does this:
> > (redefinition of both front-ends)
> > 
> >           (define/private (front-end input settings)
> >             (let ((done? #f)
> >                   (str
> >                    (if (string? input)
> >                        input
> >                        (let ([text (drscheme:language:text/pos-text input)])
> >                          (send text
> >                                get-text
> >                                (drscheme:language:text/pos-start input)
> >                                (drscheme:language:text/pos-end input))))))
> >               (lambda ()
> >                 (if done?
> >                     eof
> >                     (let [(result (pico-eval str))]
> >                       (set! done? #t)
> >                       result)))))
> > 
> > (we want the lambda to be evaluated only once because it has its own
> > read-eval-print) The result is always a string-scheme-object
> > 
> > And another small thing: our output (which we display or write to the current
> > output-window) is always in a box, like the normal display in scheme.
> > We would like it to be displayed in normally, like normal scheme-output (the
> > blue one :)) But this last thing is secondary.
> > 
> > Greetz & thnx
> > 
> > Kim & Toon
> > 
> > PS: You can download the source-code we use at infogroep.be/sPico
> > (just type make in the /usr/plt/collects/spico folder (or whatever
> > your path is, just extract the files to your collects path, and make
> > in that dir :))
> > Sorry that we are setup-plt-noobs :)
> > 
> >
> 


Posted on the users mailing list.