Gauche:lalr

Gauche:lalr

An Efficient and Portable Scheme LALR(1) Parser Generator

http://www.iro.umontreal.ca/~boucherd/Lalr/documentation/lalr.html (和訳)

lalr-2.0をGaucheで動かすには以下のパッチを当てる。

diff -crN Lalr/Makefile Lalr.new/Makefile
*** Lalr/Makefile       Thu Jun 20 03:25:57 2002
--- Lalr.new/Makefile   Fri Dec 13 19:43:38 2002
***************
*** 19,24 ****
--- 19,25 ----
        @echo "   make plt-scheme"
        @echo "   make sisc"
        @echo "   make chicken"
+       @echo "   make gauche"
        @echo "********************"
  
  #; ---------------------------------------------------------------------- ;#
***************
*** 54,59 ****
--- 55,68 ----
        @echo "done."
  
  #; ---------------------------------------------------------------------- ;#
+ #; Gauche build                                                           ;#
+ #; ---------------------------------------------------------------------- ;#
+ gauche:
+       @echo "building lalr.scm for gauche..."
+       @./lalr.skl gauche
+       @echo "done."
+ 
+ #; ---------------------------------------------------------------------- ;#
  #; documentation                                                          ;#
  #; ---------------------------------------------------------------------- ;#
  doc: 
diff -crN Lalr/lalr.skl Lalr.new/lalr.skl
*** Lalr/lalr.skl       Thu Jun 20 03:58:42 2002
--- Lalr.new/lalr.skl   Fri Dec 13 19:50:53 2002
***************
*** 9,14 ****
--- 9,15 ----
        plt-scheme) DECLS=ports/plt-scheme.decls;;
        sisc) DECLS=ports/sisc.decls;;
        chicken) DECLS=ports/chicken.decls;;
+       gauche) DECLS=ports/gauche.decls;;
        *) echo "invalid Scheme system: $1" ; exit 1;;
  esac
  
diff -crN Lalr/ports/gauche.decls Lalr.new/ports/gauche.decls
*** Lalr/ports/gauche.decls     Wed Dec 31 14:00:00 1969
--- Lalr.new/ports/gauche.decls Fri Dec 13 19:49:50 2002
***************
*** 0 ****
--- 1,7 ----
+ (begin
+   (define-macro (def-macro form . body)
+     `(define-macro ,form . ,body))
+     
+   (def-macro (BITS-PER-WORD) 30) ;; different on LP64 processors, but for now.
+   (def-macro (logical-or x . y) `(logior ,x . ,y))
+   )
More ...