Hi John,

No, this missing file is actually only needed if you also have my other
unofficial changes to Bigloo (which you very likely don't have), which
remove the default mapping of '[] to '() in the reader and allow you to
re-define the meaning of '[], along with '{} yourself (set-read-syntax!)
I tend to use '[] occasionally, hence the need to include that for 
alexpander.

Can you try with the s-expression (option (load "bracket-syntax.sch"))
removed? In the meanwhile I will package a new release to go directly
into recent Bigloo sources, time allowing.

After compiling (and installing) you need to extend your .bigloorc to
define a wrapper around the alexpander and link it to Bigloo through the
*user-pass* mechanism. I think I sent one back then but here is a new
version attached anyway.

You can either link it permanently (by uncommenting the last line in the
.bigloorc file) or decide per-invocation, by calling Bigloo like this: 

$ bigloo -eval '(set! *user-pass* *alexpand-one*)' args ...

This will preempt the existing syntax-rules expander in Bigloo. 

I have not seen it fail on any syntax-rules heavy code yet, although
there are some hacks (see sources and the .bigloorc attached) needed to
make it interoperate with Bigloo's object system, macros, DSSS,
module mechanisms and grammar rules. But if you don't use any of that,
you should not be aware, even.

Kind regards,
Peter

P.S. if you do use Bigloo's grammar mechanisms, make sure to wrap the
call to regular-grammar by a CAF binding named *XXX-reader*. 


On Fri, 2013-11-22 at 03:54 +0100, [email protected] wrote: 
> Peter, thanks for this.  Please forgive my inexperience.  I found your bundle
> and figured out how to unpack it, but "make" reports this error.  Will I need
> an older Bigloo?
> 
> bglafile alexpander-mod.scm >.afile
> bgljfile alexpander-mod.scm >.jfile
> bigloo -unsafe -q -mkaddheap -mkaddlib -v2 -heap-library  make-lib make-
> lib.scm -addheap alexpander.heap
>       [reading afile .afile]
>       [reading jfile .jfile]
>    . Heap
>       [reading /home/jtobey/bigloo4.0b/lib/bigloo/4.0b/bigloo.heap]
>    . Module
> *** ERROR:load:
> Can't open file -- bracket-syntax.sch
> make: *** [alexpander.heap] Error 1
> 
> Best regards,
> John

;(module bigloorc (export _list_33 _eqv?_17) (eval (export _eqv?_17)))

(library-load 'alexpander)

; Somehow these ones need to be defined *inside* the compiler,
; not inside the generated code...

(define _eqv?_17 eqv?)
(define _cons_31 cons)
(define _append_32 append)
(define _list_33 list)
(define _vector_34 vector)
(define _list->vector_35 list->vector)
(define _map_36 map)

(define *store* (null-mstore))

(define *occurs*? (lambda (s l)
            (cond ((pair? l) (or (*occurs*? s (car l)) (*occurs*? s (cdr l))))
                  (else (eq? s l)))))

(define *first* #t)

(expand-top-level-forms! null-output *store*)

(define (*alexpander* c)
   (cond ((null? c) c)
         ((pair? c) (list (*alexpand-one* (car c))
                          (*alexpander* (cdr c))))))

(define (*alexpand-one* c)
   (begin
      ;(pp c)
      ;(with-output-to-file "/dev/stderr" (lambda () (display c) (display 
"=>")))
      ; declare-library! being a Bigloo specific form
      ; can not be handled by alexpander properly
      (cond
         ;((*occurs*? '#unspecified c) c)
         ((*occurs*? 'match-case c) c)
         ;((*occurs*? 'regular-grammar c) c)
         ((and (pair? c) (or (eq? (car c) 'declare-library!)
                             (eq? (car c) 'define-expander)
                             (eq? (car c) 'define-macro)
                             (and (eq? (car c) 'define)
                                  (pair? (cdr c))
                                  (pair? (cadr c))
                                  (eq? (caadr c) 'read-multi-line-comment))
                             (and (pair? (cdr c)) (symbol? (cadr c)) 
(string-contains (symbol->string (cadr c)) "-grammar*"))
                             )) c)
;        ((and (pair? c) (eq? (car c) 'cond-expand)) (begin (display "HERE!!!") 
c))
         ((and (pair? c) (list? (car c))
               (or (eq? (caar c) 'begin)
                   (eq? (caar c) 'define)))
          (let ((C (expand-top-level-forms! c *store*)))
                  ;(begin ;(with-output-to-file "/tmp/stderr" (lambda () (and 
(pair? C) (display (car C))) (newline)))
                     C
                     ;)
                     ))
         (else (let ((C (expand-top-level-forms! `(,c) *store*)))
                  ;(begin ;(with-output-to-file "/dev/stderr" (lambda () (and 
(pair? C) (display (car C))) (newline)))
                     (if (pair? C) `(begin ,@C) ;(car C);
                          ; since there is no way to insert new forms
                          ; after the one that Bigloo read (the procedure
                          ; must return a form, not a list of forms), we
                          ; rely on the library provider to add the forms
                          ; from null-output manually to library.init file...
                                          ;(if (*occurs*? 'module c) (case 
*first*
                                          ;   ((#t) (begin (set! *first* #f) 
null-output))
                                          ;   (else '()))
                                          ;    '())
                                          #f)
                     ;)
                     )))))

;(set! *user-pass* *alexpand-one*)

Reply via email to