This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Portable Syntax Case


Hi all,

I've been trying to bootstrap R. Kent Dybvig and Oscar Waddell's
portable syntax case code in userspace. The code is permissively
licensed for incorporation into any implementation:
<http://www.scheme.com/syntax-case/>

I've attempted to follow the instructions in...
<http://www.scheme.com/syntax-case/psyntax.ss>

...in order to load...
<http://www.scheme.com/syntax-case/psyntax.pp>

I had to fix Kawa's potential number reader because it was mistaking
symbols prefixed with an underscore and followed by number characters as
"not a valid number" instead of symbols:

--- gnu/kawa/lispexpr/LispReader.java.original  2004-04-18 19:07:00.000000000 +1200
+++ gnu/kawa/lispexpr/LispReader.java   2004-04-18 19:35:55.000000000 +1200
@@ -293,7 +293,7 @@
            if (i == start)
              return false;
          }
-       else if (ch != '.' && ch != '_' && ch != '^')
+       else if (ch != '.' && ch != '^')
          return false;
       }
     return sawDigits > 0;


With this fixed and Kawa recompiled I have now struck this error when
attempting to load psyntax.pp:

java.lang.VerifyError: (class: atInteractiveLevel$frame, method:
lambda186genSyntaxCase669 signature:
(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;) Incompatible type for getting or setting field
        at atInteractiveLevel.apply(psyntax.pp:6)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:289)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:191)
        at kawa.Shell.run(Shell.java:233)
        at kawa.standard.load.loadSource(load.java:161)
        at kawa.standard.load.apply(load.java:273)
        at kawa.standard.load.apply2(load.java:199)
        at kawa.standard.load.apply1(load.java:189)
        at gnu.mapping.Procedure1.applyN(Procedure1.java:49)
        at gnu.mapping.Procedure.apply(Procedure.java:115)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:289)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:191)
        at kawa.Shell.run(Shell.java:233)
        at kawa.Shell.run(Shell.java:180)
        at kawa.Shell.run(Shell.java:167)
        at kawa.Shell.run(Shell.java:154)
        at kawa.repl.main(repl.java:650)

Are there any insights into the cause of this error?

To reproduce this error you will first need to load the mostly
Kawa-specific code below. Refer to the psyntax.ss comments for details:

(define (make-hash)
  (make <java.util.Hashtable>))

(define (hash-ref hashtable :: <java.util.Hashtable> key)
  (let ((value (invoke hashtable 'get key)))
    (if (eq? value #!null) #f value)))

(define (hash-set! hashtable :: <java.util.Hashtable> key value)
  (invoke hashtable 'put key value))

(define (hash-rm! hashtable :: <java.util.Hashtable> key)
  (invoke hashtable 'remove key))


(define (void) (values))

(define (andmap f first . rest)
  (or (null? first)
      (if (null? rest)
          (let andmap ((first first))
            (let ((x (car first)) (first (cdr first)))
              (if (null? first)
                  (f x)
                  (and (f x) (andmap first)))))
          (let andmap ((first first) (rest rest))
            (let ((x (car first))
                  (xr (map car rest))
                  (first (cdr first))
                  (rest (map cdr rest)))
              (if (null? first)
                  (apply f (cons x xr))
                  (and (apply f (cons x xr)) (andmap first rest))))))))

(define (ormap proc list1)
  (and (not (null? list1))
       (or (proc (car list1)) (ormap proc (cdr list1)))))

(define (gensym) (gentemp))

(define getprop #f)
(define putprop #f)
(define remprop #f)
(let ((property-hash (make-hash)))
  (set! getprop (lambda (symbol key)
		  (let ((alist (hash-ref property-hash symbol)))
		    (if alist (assq key alist) #f))))
  ;;putprop has no well-defined return value
  (set! putprop (lambda (symbol key value)
                  (let ((alist (hash-ref property-hash symbol)))
                    (if alist
                        (begin (set! alist (alist-delete! key alist eq?))
                               (hash-set! property-hash symbol
                                          (alist-cons key value alist)))
                        (hash-set! property-hash symbol
                                   (alist-cons key value '()))))))
  ;;remprop has no well-defined return value
  (set! remprop (lambda (symbol key)
                  (let ((alist (hash-ref property-hash symbol)))
                    (when alist
                      (set! alist (alist-delete! key alist eq?))
                      (if (null? alist)
                          (hash-rm! property-hash symbol)
                          (hash-set! property-hash symbol alist)))))))


I haven't implemented their special form of eval, but this shouldn't
matter for the error in question because "eval will not be invoked
during the loading of psyntax.pp".

The JVM is Sun's "1.4.2_03" Java(TM) 2 Runtime Environment, Standard
Edition (build 1.4.2_03-b02). Running on Debian sid with a 2.4 kernel.

Many thanks for any suggestions.

Regards,
Adam


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]