Re: Question about porting mzscheme code
"D. O'Keeffe" <[email protected]> 18 Feb 2009 01:29:47 +0000
| Newsgroups | gmane.comp.java.sisc.user |
|---|---|
| Message-ID | <[email protected]> |
Hey Joshua, I had a look at the links you gave me. The lexical analysis
package in combination with the previously mentioned parser package would
seem to do the trick. However, I'm not sure the java bridge to plt will
help me to much, as I'm trying to call scheme code from java. From what I
can gather the java bridge is used mainly in the other direction. Is that
correct? In any event, I've begun porting my code over, but I'm having some
small problems relating to the use of mzscheme's define-struct construct.
>From what I can gather, this is supported by sisc, but I can't seem to get
it to work. I've imported the record module as suggested in the
documentation (http://lampwww.epfl.ch/~linuxsoft/sisc/ch09.html#Records).
Is there anything else I should be doing?
My module definition goes something like:
(module cep-structs
(ce-definition ce-inst)
(import record)
(define-struct ce-definition (a b))
(define-struct ce-inst (c d))
)
I load the class cep-structs.scm, which seems to work, but when I then try
and use the loaded definitions (e.g. (display ce-definition)), it says
Error: undefined variable 'ce-definition' I'm using the Sisc interpreter
that comes as part of SchemeScript, an Eclipse plugin for scheme.
Thanks,
Dan
On Feb 10 2009, Joshua Herman wrote:
>There is a lexical analysis package at SILex (tarball)
><http://www.iro.umontreal.ca/~dube/silex.tar.gz>
>as long as your code is r5rs compliant and only uses those libraries it
>should be straightforward to port it. Also, you might want to look at a
>java bridge for plt scheme to your code.
>http://www.cs.brown.edu/pipermail/plt-scheme/2006-September/014728.html may
>help
>On Mon, Feb 9, 2009 at 2:32 PM, D. O'Keeffe <[email protected]> wrote:
>
>> Hey Joshua,
>> Thanks for the reply. The module definitions looks something like:
>>
>> ;;ce-parser.scm
>> ;; module provides the get-ce-expr function that takes in an expression
>> ;; to parse in string form and returns the resulting parsed expression.
>> (module ce-parser mzscheme
>> (require
>> (lib "yacc.ss" "parser-tools")
>> (lib "lex.ss" "parser-tools")
>> (prefix : (lib "lex-sre.ss" "parser-tools")))
>> (require "cep-structs.scm")
>> (require "initiate.scm")
>>
>> ...
>>
>> ;;get-ce-expr: string -> ce-expr
>> (define get-ce-expr
>> (lambda (expr-string)
>> ...))
>>
>> (provide get-ce-expr))
>>
>> ;; cep-structs.scm
>> (module cep-structs mzscheme
>> ....
>> (provide (all-defined) (all-from mzscheme))
>>
>> ;; initiate.scm
>> (module initiate mzscheme
>> (require "cep-structs.scm")
>> (require "terminate.scm")
>> (require "cep-utils.scm")
>> ....
>> (provide create-ce-expr))
>>
>> ;; terminate.scm
>> (module terminate mzscheme
>> (require "cep-structs.scm")
>> ....
>> (provide terminate-ce-expr))
>>
>> ;; cep-util.scm
>> (module cep-util mzscheme
>> (require "cep-structs.scm")
>> (require (lib "list.ss" "mzlib"))
>> ....
>> (provide (all-defined)))
>>
>>
>> If it helps to clarify things, the parser tools code can be found at
>> http://pre.plt-scheme.org/plt/collects/parser-tools/
>>
>> The main queries I have are with respect to the changes needed in terms
>> of syntax etc. to perform the correct imports and exports between
>> modules and loading of libraries. From reading the sisc user manual, it
>> would seem that the sisc module system is based on that of chez scheme.
>> Is this correct? Are there any other major differences that you think I
>> should be aware of? I think once I manage to get my mzscheme code
>> working in sisc I'll be ok (i.e. I think I understand how to use it from
>> java). Thanks for your help! Dan
>>
>> On Feb 8 2009, Joshua Herman wrote:
>>
>> > Can you give us part of the code at least the libraries it uses? sisc
>> > is a better implementation though.
>> >
>> >
>> >> Hey all, I'm trying to determine the best way to port some code I
>> >> have written in mzscheme to be used by a java program. I've been
>> >> looking into both kawa and sisc. Performance isn't especially
>> >> critical, as I'm only using it as part of a simulation/experiment I
>> >> need to perform for a paper I'm writing. The code depends on the plt
>> >> scheme parser-utils library, but other than that I don't think it
>> >> contains anything that might present too many problems. However, I'm
>> >> relatively new to scheme (this code is the first (and only!) project
>> >> I've written in it), and time is of the essence. If anyone can tell
>> >> me which approach is likely to be quicker (or of a better approach)
>> >> I'd appreciate it. Thanks, D
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>>
>>
>> ------------------------------------------------------------------------------
>> >> Create and Deploy Rich Internet Apps outside the browser with
>> >> Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use
>> >> existing skills and code to build responsive, highly engaging
>> >> applications that combine the power of local resources and data with
>> >> the reach of the web. Download the Adobe AIR SDK and Ajax docs to
>> >> start building applications today- http://p.sf.net/sfu/adobe-com
>> >> _______________________________________________ Sisc-users mailing
>> >> list [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/sisc-users
>> >>
>> >
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Create and Deploy Rich Internet Apps outside the browser with
>> Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use
>> existing skills and code to build responsive, highly engaging
>> applications that combine the power of local resources and data with the
>> reach of the web. Download the Adobe AIR SDK and Ajax docs to start
>> building applications today- http://p.sf.net/sfu/adobe-com
>> _______________________________________________ Sisc-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sisc-users
>>
>
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H