简体   繁体   中英

How can lisp (scheme) be compiled to binary file?

I am using a softerware who has a build-in scheme interpreter. Users can communicate / manipulate the software by typing command in the interpreter. And users also could load some binary file to the environment. I have write some scheme code like this:

(define test (lambda() (display "This is a test!"))) ---- d:/test.scm

And then compile it into binary file which will be loaded and excuted much faster. But the document has no information about compilation of the scheme code. After compilation user could load the binary file by typing:

(fast-load "d:/test.bin" (the-environment))

I think the "fast-load" just do read and eval things. So does the compilation is just a encrypting process? Does anybody know about these things? Any information will be appreciated! Thanks in advance.

And there is another example: the AutoCAD system. Users can write lisp code to manipulate the AutoCAD. And user could compile the lisp code into *.fas file which will be loaded into AutoCAD. So if it is really only an encrypting process, how can I write a compiler? Is there any documents about it?

                                                                       Joe

If you are strictly talking about the application's built-in interpreter (as seems to be the case based on your question), there's no standard answer. You'll need to see if the application designer built compilation into their implementation and exposed that functionality for you. If not you're out of luck.

If you were to ask about stand-alone Scheme applications or libraries, many implementations (such as Chicken ) provide Scheme compilers of one sort or another (the previously-mentioned Chicken Scheme compiles to C first).

If you were asking about Common Lisp (ignoring the fact that you mention Scheme specifically in your title and question). You can use the standard function, compile-file , which produces the .fasl format you alluded to at the end of your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM