From: Timothy H. <tim...@ma...> - 2002-05-26 12:56:12
|
Hi Darrel, How has your Scheme interpreter applet project for WISE been progressing lately? I recently checked in a new Scheme Interpereter applet that you might be interested in. It should run in all browsers http://www.cs.brandeis.edu/~tim/jscheme/src/jlib/demo/SchemeEval.html and it does "paren matching" and auto-indenting. Since "flashing" parens is fairly difficult to implement in Java 1.1, this applet has an extra textarea showing the most recently matched complete expression. It is implemented entirely in Scheme with no additional Java classes needed. Please feel free to "steal" anything you want from the code, it is open-source with zlib/png licensing (the most open of the open-source licenses). We hope to add a "reformat" button, that will auto-indent every line of the file. Also, improved error reporting would be helpful especially for pedagogical purposes. For Java 1.2+ applets (or Java Web Start), we can use Swing highlighting for paren matching.... ----Tim--- On Saturday, March 30, 2002, at 12:33 AM, Dazhi Liu wrote: > Hi, > > I've downloaded the latest JScheme and finally had the applet compiled > under JDK 1.3.1_03 and run under both IE and Netscape 4.x. The problem > seemed to be that JDK 1.4 compiled a version that's imcompatible with > previous versions of JVM. > > Thank you for all your help. > > Best regards, > Darrel > > |
From: Dazhi L. <da...@uc...> - 2002-05-26 18:18:46
|
Hi Timothy, Thank you for asking! Actually it went pretty well. We rewrote part of that EditArea component so it does basic paren matching and indenting, enough for a listener. Since our project requires a more sophisticated Scheme editor, which should be able to do syntax highlighting, custmizable indenting and find/replace etc, we did this with Swing. So a jseditor module is added to the project, which can communicate with instances of listeners through a static hashtable (AppletStore). Our latest working version and source can be found at: http://wiser.cs.berkeley.edu/citris/darrel/jscheme/ BTW, a quick question: After user program in JScheme for a while, is there an easy way to erase all user defined bindings, that is, to return to the initial state of JScheme? I'll take a look at your link. But since I'm graduating and sort of finishing up my work on this project, I may not have time to switch to a different implementation. Darrel Timothy Hickey wrote: > Hi Darrel, > > How has your Scheme interpreter applet project for WISE been > progressing lately? > > I recently checked in a new Scheme Interpereter applet > that you might be interested in. It should run in all browsers > > http://www.cs.brandeis.edu/~tim/jscheme/src/jlib/demo/SchemeEval.html > > and it does "paren matching" and auto-indenting. > > Since "flashing" parens is fairly difficult to implement in Java 1.1, > this applet has an extra textarea showing the most recently > matched complete expression. It is implemented entirely in > Scheme with no additional Java classes needed. > > Please feel free to "steal" anything you want from the code, > it is open-source with zlib/png licensing (the most open of > the open-source licenses). > > We hope to add a "reformat" button, that will auto-indent every > line of the file. Also, improved error reporting would be > helpful especially for pedagogical purposes. For Java 1.2+ > applets (or Java Web Start), we can use Swing highlighting > for paren matching.... > > ----Tim--- |
From: Timothy H. <tim...@ma...> - 2002-05-26 20:13:39
|
On Sunday, May 26, 2002, at 02:15 PM, Dazhi Liu wrote: > BTW, a quick question: After user program in JScheme for a while, is > there an easy way to erase all user defined bindings, that is, to return > to the initial state of JScheme? > Its not too hard. At the end of this note is a procedure that creates a SymbolTable restorer. You use it as > (define z (make-state-restorer)) .... > (z) and it will restore your state to the initial one. ;; This is a System restorer ;; It makes a copy of the Symbol table state which it stores in its returned value ;; > (define z (make-state-restorer)) ;; When you later invoke the thunk ;; > (z) ;; it resets the Symbol table to its ;; original values (but it doesn't reset the javadot primitives as this would just ;; waste time). (define (make-state-restorer) (let ((ST0 (java.util.Hashtable.)) (isJavadot (lambda (x) (or (> (.indexOf x ".") -1) (> (.indexOf x "$") -1)))) (enum->list (lambda(E) (let loop ((L ())) (if (.hasMoreElements E) (loop (cons (.nextElement E) L)) L))))) (for-each (lambda(x) (if (not (isJavadot x)) ;; don't remember javadots! (.put ST0 x (tryCatch (list (.getGlobalValue (string->symbol x))) (lambda(e) ()))))) (enum->list (.keys jsint.Symbol.symbolTable$))) (display (length (enum->list (.keys ST0))))(newline) (lambda() (let ((ST jsint.Symbol.symbolTable$)) (for-each (lambda(x) (let ((v (.get ST0 x))) (if (equal? #null v) (if (not (isJavadot x)) (begin (display x)(newline) (.remove ST x))) (let ((s (string->symbol x))) (.put ST x s) (if (not (null? v)) (.setGlobalValue s (first v))))))) (enum->list (.keys ST))))))) |
From: Dazhi L. <da...@uc...> - 2002-05-26 22:17:37
|
Thank you very much! I'll integrate this into the listener. Regards, Darrel Timothy Hickey wrote: > > On Sunday, May 26, 2002, at 02:15 PM, Dazhi Liu wrote: > >> BTW, a quick question: After user program in JScheme for a while, is >> there an easy way to erase all user defined bindings, that is, to return >> to the initial state of JScheme? >> > > > > Its not too hard. At the end of this note is a procedure that creates > a SymbolTable > restorer. You use it as > > > (define z (make-state-restorer)) > .... > > (z) > and it will restore your state to the initial one. > > > > ;; This is a System restorer > ;; It makes a copy of the Symbol table state which it stores in its > returned value > ;; > (define z (make-state-restorer)) > ;; When you later invoke the thunk > ;; > (z) > ;; it resets the Symbol table to its > ;; original values (but it doesn't reset the javadot primitives as > this would just > ;; waste time). > > (define (make-state-restorer) > (let > ((ST0 > (java.util.Hashtable.)) > (isJavadot (lambda (x) > (or (> (.indexOf x ".") -1) (> (.indexOf x "$") -1)))) > (enum->list > (lambda(E) > (let loop ((L ())) > (if (.hasMoreElements E) > (loop (cons (.nextElement E) L)) > L))))) > (for-each > (lambda(x) > (if (not (isJavadot x)) ;; don't remember javadots! > (.put ST0 x > (tryCatch > (list (.getGlobalValue (string->symbol x))) > (lambda(e) > ()))))) > (enum->list (.keys jsint.Symbol.symbolTable$))) > > (display (length (enum->list (.keys ST0))))(newline) > > (lambda() > (let ((ST jsint.Symbol.symbolTable$)) > (for-each > (lambda(x) > (let ((v (.get ST0 x))) > (if (equal? #null v) > (if (not (isJavadot x)) > (begin (display x)(newline) (.remove ST x))) > (let ((s (string->symbol x))) > (.put ST x s) > (if (not (null? v)) > (.setGlobalValue s (first v))))))) > (enum->list (.keys ST))))))) > > > |