guix environment --system=i686-linux -l guix.scm #32 bit only
** Other GNU/Linux
+*** Nyacc, 0.78.0 is known to work.
+Matt Wette's C99 LALR parser.
+
*** A C compiler, GNU Gcc 4.9.3 is known to work.
The idea is to drop this requirement, of course.
*** /bin/sh, GNU Bash 4.3 is known to work.
Let's just say for now that it gets awkward without a shell.
-
*** Development (but see [[./guix.scm]])
*** GNU coreutils
EOF
exit 1
fi
-unset GUILE_AUTO_COMPILE GUILE_LOAD_COMPILED_PATH
exec ${GUILE} --no-auto-compile -L $(pwd) -e '(@@ (configure) main)' -s "$0" ${1+"$@"}
!#
(map string->number version)))
(define required '())
-(define* (check-version command expected
- #:optional
+(define* (check-version name expected
+ #:key
(deb #f)
(version-option '--version)
- (compare tuple<=))
- (stderr "checking for ~a~a..." command
+ (compare tuple<=)
+ (command name))
+ (stderr "checking for ~a~a..." name
(if (null? expected) ""
(format #f " [~a]" (version->string expected))))
(let* ((output (gulp-pipe (format #f "~a ~a 2>&1" command version-option)))
(stderr "~a ~a\n" (if pass? (if (pair? actual) "" " yes")
(if actual " no, found" "")) (version->string actual))
(or pass?
- (if (not (pair? command)) (begin (set! required (cons (or deb command) required)) pass?)
- (check-version (cdr command) expected deb version-option compare)))))
+ (if (not (pair? name)) (begin (set! required (cons (or deb name) required)) pass?)
+ (check-version (cdr name) expected deb version-option compare)))))
(define* (check-pkg-config package expected #:optional (deb #f))
(check-version (format #f "pkg-config --modversion ~a" package) expected deb))
(check-version 'guile '(2 0))
(check-version 'make '(4 0))
(check-version 'perl '(5))
+ (check-version 'nyacc '(0 78 0) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'"))
(when (pair? required)
(stderr "\nMissing dependencies [~a], run\n\n" ((->string ", ") required))
(gnu packages cross-base)
(gnu packages gcc)
(gnu packages guile)
+ (gnu packages mes)
(gnu packages package-management)
(gnu packages perl)
((guix build utils) #:select (with-directory-excursion))
(url "https://gitlab.com/janneke/mes")
(commit commit)))
(file-name (string-append name "-" version))
- ;; TODO: Unbundle nyacc.
(sha256
(base32 "1ynr0hc0k15307sgzv09k3y5rvy46h0wbh7zcblx1f9v7y8k90zv"))))
(build-system gnu-build-system)
(supported-systems '("x86_64-linux"))
+ (propagated-inputs
+ `(("nyacc" ,nyacc)))
(native-inputs
`(("guile" ,guile-2.2)
;; Use cross-compiler rather than #:system "i686-linux" to get
(define-public mes.git
(package
(inherit mes)
- (name "mes.git")
+ (name "mes")
(version "git")
(source (local-file %source-dir #:recursive? #t #:select? git-file?))))
all-go: GUILE_FLAGS:=$(GUILE_FLAGS)
all-go: $(SCM_FILES)
$(QUIET)rm -f $@
- $(QUIET)cd $(DIR) && srcdir=$(srcdir) host=$(host) $(GUILE) $(GUILE_FLAGS:guile=../guile) -s ../build-aux/compile-all.scm $(SCM_FILES:$(DIR)/%=%)
+ $(QUIET)cd guile && srcdir=$(srcdir) host=$(host) $(GUILE) $(GUILE_FLAGS:guile=.) -s ../build-aux/compile-all.scm $(SCM_FILES:$(DIR)/%=%)
$(GO_FILES): all-go
SCM_FILES:=$(filter-out %pretty-print.scm, $(SCM_FILES))
SCM_FILES:=$(filter-out %syntax.scm, $(SCM_FILES))
SCM_FILES:=$(filter-out module/mes/peg/%.scm, $(SCM_FILES))
-SCM_FILES:=$(filter-out module/nyacc/lang/c99/body.scm, $(SCM_FILES))
-SCM_FILES:=$(filter-out module/nyacc/lang/c99/mach.d/%.scm, $(SCM_FILES))
-SCM_FILES:=$(filter-out module/nyacc/lang/c99/mach.scm, $(SCM_FILES))
-SCM_FILES:=$(filter-out module/nyacc/lang/c99/xparser.scm, $(SCM_FILES))
include make/guile.make
# FIXME: https://gitlab.com/janneke/guile/commits/1.8
+++ /dev/null
-Copyright (C) 2016 Matthew R. Wette
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
-
-BUG-005 <= next bug id
-
-BUG-004 Idea: use guile prompts to implement rollback parser
-
-BUG-003 If using phony prec token then it ends up in match table.
- For example, "then" appears in the match table for lang/c99.
-
-=fixed=
-
-BUG-001 In lalr.scm, hashify-machine, if pat contains a rrconf then the output
- is unspecified
- todo I think this was already fixed
-
-BUG-002 If mach has a conflict and hashify followed by pp-lalr-machine then
- error because hashify puts #f, not integer, for pat-v.
- fixed fixed pp-lalr-machine to check for #f
-
+++ /dev/null
-2017-05-06 Matt Wette <mwette@alumni.caltech.edu>
-
- * lalr.scm: updated write-lalr-tables and write-lalr-actions to
- accept a prefix string
-
-2017-05-04 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/pprint.scm (pretty-print-c99): removed double spacing
- in printed declarations
-
- * lang/util.scm (make-pp-formatter): fixed bug in column counting
- that prevented line-wrap to occur.
-
-2017-04-12 Matt Wette <mwette@alumni.caltech.edu>
-
- * lex.scm (make-comm-reader): comments which end in newline can
- now also end in #<eof>
-
-2017-03-11 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/parser.scm (parse-c99): added mode keyword argument to
- gen-c-lexer, file mode would not have been working ...
-
-2017-03-03 Matt Wette <mwette@alumni.caltech.edu>
-
- * lalr.scm: added "keepers" keyword argument to compact-machine
- and also added $end as default
-
-2017-02-28 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/pprint.scm: (binary 'd-del .. => (binary 'd-sel
-
-2017-02-22 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/cpp.scm (rtokl->string): added handler for 'string
-
- * lang/c99/body.scm: added 'skip state so that if skipping #if
- then no CPP if or elif arguments are evaluated
-
- * lang/c99/cpp.scm: parse 0L numbers, convert c numbers (e.g.,
- 123L) to scheme so that string->number works. I need to update
- cnumstr->snumstr in nyacc/lex.scm.
-
-2017-02-16 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/cpp.scm (rtokl->string): now handled symb ## arg ## symb
- (scan-cpp-input): skip-il-ws after #\(
-
-2017-01-18 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/parser.scm: check for EOF in end of CPP line
-
- * lang/c99/mach.scm (c99-spec): decl for translation unit was
- updated to allow programs with no declarations or statements
-
-2017-01-08 Matt Wette <mwette@alumni.caltech.edu>
-
- * ../../test-suite/nyacc/lang/c99/exam.d/ex05.c: C99 does not
- allow lone `;' outside of functions. Removed.
-
-2017-01-07 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/body.scm (read-cpp-line): cpp statement should not
- include newline? Changed to unread final newline.
-
- * lang/util.scm: add report-error: prints msg w/ file, line
-
- * parse.scm (make-lalr-parser): changed printout of parse error to
- (throw 'parse-error . args) and expect the full parser to catch
- the error
-
- * lang/c99/mach.scm (c99-spec): from
- 2017-01-07 Jan Nieuwenhuizen <janneke@gnu.org>
- mising unquote in output sx for goto: `(goto $2) => `(goto ,$2)
-
-2017-01-06 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/parser.scm: default parser #:mode is now 'code; done
- since the CPP should now be working (??)
-
- * lalr.scm (process-spec): in add-el changed memq to member since
- we are using strings for terminals
-
-2017-01-02 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/mach.scm (c99-spec): added hooks (cpp-ok!, no-cpp!) to
- provide handshaking between parser and lexer wrt when the lexer
- can pass CPP statements to the parser
-
- * lang/c99/cppbody.scm (expand-cpp-mref): skip ws between ident
- and left paren
-
-2017-01-01 Matt Wette <mwette@alumni.caltech.edu>
-
- * lang/c99/body.scm (gen-c-lexer): in code mode now expands includes
-
- * lang/c99/pprint.scm (pretty-print-c99): added enum-dev w/o name
-
-2016-11-25 Matt Wette <mwette@alumni.caltech.edu>
-
- * added support for ellipsis to lang/c99/cpp.scm
-
-2016-11-24 Matt Wette <mwette@alumni.caltech.edu>
-
- * added (ellipsis) to lang/c99/pprint.scm
-
-2016-04-09 Matt Wette <mwette@alumni.caltech.edu>
-
- * bison.scm: new file providing make-lalr-machin/bison. It is
- similar to make-lalr-machine but uses external bison program
- instead of the default from-scratch lalr code.
-
-2016-03-04 Matt Wette <mwette@alumni.caltech.edu>
-
- * lalr.scm: changed grammar parser to interpret $string as
- terminal. This saves typing a quote in front.
-
-Copyright (C) 2015-2017 Matthew R. Wette
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
-
+++ /dev/null
-nyacc/README
-
- Copyright (C) 2016 Matthew R. Wette
-
- Copying and distribution of this file, with or without modification,
- are permitted in any medium without royalty provided the copyright
- notice and this notice are preserved. This file is offered as-is,
- without any warranty.
-
-
-strategy for generating parsers and other stuff
-
-guile -s mach.scm -c '(@ (nyacc lang c99 mach) gen-mach-files)'
-=> .scm/{actions.scm,tables.scm}
-#guild compile
-
-eval-when?
-
-use-case: dist mach-files and parser
-
-dist:
- mach.scm
-
-
-===============================================================================
-
-dev-parser.scm: mach.scm pbody.scm mk-parser.scm
-parser.scm: mach.scm pbody.scm mk-parser.scm
-expr-parser.scm: mach.scm pbody.scm mk-parser.scm
-
-$ guile -l cppmach.scm -c '(@ (nyacc lang c99 cppmach) gen-cpp-files)'
-> cppact.scm cpptab.scm
-
-$ guile -l mach.scm -c '(@ (nyacc lang c99 mach) gen-c99-files)'
-> c99act.scm c99tab.scm
-
-$ guile -l mach.scm -c '(@ (nyacc lang c99 mach) gen-c99x-files)'
-> c99xact.scm c99xtab.scm
-
-===============================================================================
-
-install:
- cpp.go
- mach.go
- parser.go
- xparser.go
- pprint.go
- util1.go
- util1.go
-
-cpp.scm: cppmach.scm
-
-#cppmach.scm (export-files
-
+++ /dev/null
-This is a version 0.76.5+jsdev of NYACC (Not Yet Another Compiler Compiler!).
-
-Copyright (C) 2015-2017 Matthew R. Wette
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
-
-Full source distribution for NYACC is available at
- https://download.savannah.gnu.org/project/nyacc
-
-This software package is covered by the following licenses:
-* GNU PUBLIC GENERAL LICENCE, version 3 (See COPYING.)
-* GNU LESSER PUBLIC GENERAL LICENCE, version 3 (See COPYING.LESSER.)
-* GNU Free Documentation License, version 1.3 (See doc/nyacc/COPYING.DOC.)
-
-There is an incomplete manual in doc/nyacc/.
-
-There is a demo program calc.scm in examples/nyacc/lang/calc. Easy starter:
- $ cd examples/nyacc/lang/calc
- $ ./calc
- 2 + 2 => 4
-
-The module code is in module/nyacc. Modules are imported as follows:
- (use-modules (nyacc lalr))
- (use-modules (nyacc lex))
-
-If you have a personal guile directory then you can copy modules/nyacc
-to that directory. To install in the global guile distribution:
- user$ sudo -s
- root# cd module
- root# make -f Makefile.nyacc install
- root# exit
- user$
-
-The syntax and nomenclature should be considered not stable.
-
+++ /dev/null
-;;; nyacc/bison.scm
-;;;
-;;; Copyright (C) 2016 Matthew R. Wette
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-(define-module (nyacc bison)
- #:export (make-lalr-machine/bison)
- #:use-module (sxml simple)
- #:use-module (sxml match)
- #:use-module (sxml xpath)
- #:use-module (ice-9 pretty-print)
- #:use-module ((srfi srfi-1) #:select (fold))
- #:use-module ((srfi srfi-43) #:select (vector-for-each vector-map))
- #:use-module (nyacc export)
- #:use-module (nyacc lalr) ; gen-match-table
- )
-
-;; @deffn chew-on-grammar tree lhs-v rhs-v terms => a-list
-;; Generate a-list that maps bison rule index to NYACC rule index.
-(define (chew-on-grammar tree lhs-v rhs-v terms) ;; bison-rule => nyacc-rule map
-
- ;; match rule index, if no match return @code{-1}
- ;; could be improved by starting with last rule number and wrapping
- (define (match-rule lhs rhs)
- (let iter ((ix 0))
- (if (eqv? ix (vector-length lhs-v)) -1
- (if (and (equal? lhs (elt->bison (vector-ref lhs-v ix) terms))
- (equal? rhs (vector->list
- (vector-map
- (lambda (ix val) (elt->bison val terms))
- (vector-ref rhs-v ix)))))
- ix
- (iter (1+ ix))))))
-
- ;; this is a fold
- (define (rule->index-al tree seed)
- (sxml-match tree
- ;; Skip first bison rule: always $accept.
- ((rule (@ (number "0")) (lhs "$accept") . ,rest)
- (acons 0 0 seed))
- ;; This matches all others.
- ((rule (@ (number ,n)) (lhs ,lhs) (rhs (symbol ,rhs) ...))
- (acons (string->number n) (match-rule lhs rhs) seed))
- (,otherwise seed)))
-
- (fold rule->index-al '() ((sxpath '(// rule)) tree)))
-
-;; @deffn chew-on-automaton tree gx-al bs->ns => a-list
-;; This digests the automaton and generated the @code{pat-v} and @code{kis-v}
-;; vectors for the NYACC automaton.
-(define (chew-on-automaton tree gx-al bs->ns)
-
- (define st-numb
- (let ((xsnum (sxpath '(@ number *text*))))
- (lambda (state)
- (string->number (car (xsnum state))))))
-
- (define (do-state state)
- (let* ((b-items ((sxpath '(// item)) state))
- (n-items (fold
- (lambda (tree seed)
- (sxml-match tree
- ((item (@ (rule-number ,rns) (point ,pts)) . ,rest)
- (let ((rn (string->number rns))
- (pt (string->number pts)))
- (if (and (positive? rn) (zero? pt)) seed
- (acons (assq-ref gx-al rn) pt seed))))
- (,otherwise (error "broken item")))) '() b-items))
- (b-trans ((sxpath '(// transition)) state))
- (n-trans (map
- (lambda (tree)
- (sxml-match tree
- ((transition (@ (symbol ,symb) (state ,dest)))
- (cons* (bs->ns symb) 'shift (string->number dest)))
- (,otherwise (error "broken tran")))) b-trans))
- (b-redxs ((sxpath '(// reduction)) state))
- (n-redxs (map
- (lambda (tree)
- (sxml-match tree
- ((reduction (@ (symbol ,symb) (rule "accept")))
- (cons* (bs->ns symb) 'accept 0))
- ((reduction (@ (symbol ,symb) (rule ,rule)))
- (cons* (bs->ns symb) 'reduce
- (assq-ref gx-al (string->number rule))))
- (,otherwise (error "broken redx" tree)))) b-redxs))
- )
- (list
- (st-numb state)
- (cons 'kis n-items)
- (cons 'pat (append n-trans n-redxs)))))
-
- (let ((xsf (sxpath '(itemset item (@ (rule-number (equal? "0"))
- (point (equal? "2")))))))
- (let iter ((data '()) (xtra #f) (states (cdr tree)))
- (cond
- ((null? states) (cons xtra data))
- ((pair? (xsf (car states)))
- (iter data (st-numb (car states)) (cdr states)))
- (else
- (iter (cons (do-state (car states)) data) xtra (cdr states)))))))
-
-;; @deffn atomize symbol => string
-;; This is copied from the module @code{(nyacc lalr)}.
-(define (atomize terminal) ; from lalr.scm
- (if (string? terminal)
- (string->symbol (string-append "$:" terminal))
- terminal))
-
-;; @deffn make-bison->nyacc-symbol-mapper terminals non-terminals => proc
-;; This generates a procedure to map bison symbol names, generated by the
-;; NYACC @code{lalr->bison} procedure, (back) to nyacc symbols names.
-(define (make-bison->nyacc-symbol-mapper terms non-ts)
- (let ((bs->ns-al
- (cons*
- '("$default" . $default)
- '("$end" . $end)
- (map (lambda (symb) (cons (elt->bison symb terms) symb))
- (append (map atomize terms) non-ts)))))
- (lambda (name) (assoc-ref bs->ns-al name))))
-
-;; fix-pa
-;; fix parse action
-(define (fix-pa pa xs)
- (cond
- ((and (eqv? 'shift (cadr pa))
- (> (cddr pa) xs))
- (cons* (car pa) (cadr pa) (1- (cddr pa))))
- ((and (eqv? 'shift (cadr pa))
- (= (cddr pa) xs))
- (cons* (car pa) 'accept 0))
- (else pa)))
-
-;; @deffn fix-is is xs rhs-v
-;; Convert xxx
-(define (fix-is is xs rhs-v)
- (let* ((gx (car is))
- (rx (cdr is))
- (gl (vector-length (vector-ref rhs-v gx))))
- (if (= rx gl) (cons gx -1) is)))
-
-;; @deffn spec->mac-sxml spec
-;; Write bison-converted @var{spec} to file, run bison on it, and load
-;; the bison-generated automaton as a SXML tree using the @code{-x} option.
-(define (spec->mach-sxml spec)
- (let* ((basename (tmpnam))
- (bisname (string-append basename ".y"))
- (xmlname (string-append basename ".xml"))
- (tabname (string-append basename ".tab.c")))
- (with-output-to-file bisname
- (lambda () (lalr->bison spec)))
- (system (string-append "bison" " --xml=" xmlname " --output=" tabname
- " " bisname))
- (let ((sx (call-with-input-file xmlname
- (lambda (p) (xml->sxml p #:trim-whitespace? #t)))))
- (delete-file bisname)
- (delete-file xmlname)
- (delete-file tabname)
- sx)))
-
-;; @deffn make-lalr-machine/bison spec => mach
-;; Make a LALR automaton, consistent with that from @code{make-lalr-machine}
-;; using external @code{bison} program.
-(define (make-lalr-machine/bison spec)
- (let* ((terminals (assq-ref spec 'terminals))
- (non-terms (assq-ref spec 'non-terms))
- (lhs-v (assq-ref spec 'lhs-v))
- (rhs-v (assq-ref spec 'rhs-v))
- (s0 (spec->mach-sxml spec))
- (sG ((sxpath '(bison-xml-report grammar)) s0))
- (sG (if (pair? sG) (car sG) sG))
- (sA ((sxpath '(bison-xml-report automaton)) s0))
- (sA (if (pair? sA) (car sA) sA))
- (pG (chew-on-grammar sG lhs-v rhs-v terminals))
- (bsym->nsym (make-bison->nyacc-symbol-mapper terminals non-terms))
- (pA (chew-on-automaton sA pG bsym->nsym))
- (xs (car pA))
- (ns (caadr pA))
- (pat-v (make-vector ns #f))
- (kis-v (make-vector ns #f))
- )
- ;;(pretty-print sA)
- (for-each
- (lambda (state)
- (let* ((sx (car state))
- (sx (if (>= sx xs) (1- sx) sx))
- (pat (assq-ref (cdr state) 'pat))
- (pat (map (lambda (pa) (fix-pa pa xs)) pat))
- (kis (assq-ref (cdr state) 'kis))
- (kis (map (lambda (is) (fix-is is xs rhs-v)) kis)))
- (vector-set! pat-v sx pat)
- (vector-set! kis-v sx kis)))
- (cdr pA))
- (gen-match-table
- (cons*
- (cons 'pat-v pat-v)
- (cons 'kis-v kis-v)
- (cons 'len-v (vector-map (lambda (i v) (vector-length v)) rhs-v))
- (cons 'rto-v (vector-copy lhs-v))
- spec))))
-
-
-;; --- last line ---
-
+++ /dev/null
-;;; nyacc/export.scm
-;;;
-;;; Copyright (C) 2015,2017 Matthew R. Wette
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-(define-module (nyacc export)
- #:export (lalr->bison
- lalr->guile
- c-char token->bison elt->bison
- )
- #:use-module ((nyacc lalr) #:select (find-terminal pp-rule lalr-start))
- #:use-module (nyacc lex)
- #:use-module (nyacc util)
- #:use-module ((srfi srfi-1) #:select (fold))
- #:use-module ((srfi srfi-43) #:select (vector-for-each))
- #:use-module (ice-9 regex)
- )
-
-;; The code below, for exporting to guile and bison, should be moved to
-;; an "export" module.
-
-;; terminal:
-;; ident-like-string -> caps
-;; non-ident-like-string -> ChSeq_#_# ...
-;; symbol -> if $, use _, otherwise ???
-
-;; breakdown:
-;; 1 terminal, or non-terminal:
-;; 2 if non-terminal,
-;; replace - with _, replace $ with _
-;; 3 if terminal, (output of @code{find-terminal})
-;; if symbol, use 2
-;; replace char with (c-char .)
-;; if length-1 string replace with (c-char .)
-;; if like-c-ident string, replace with CAPS
-;; otherwise use ChSeq
-
-(define re/g regexp-substitute/global)
-
-(define (chseq->name cs)
- (let* ((iseq (string-fold (lambda (c s) (cons* (char->integer c) s)) '() cs))
- (tail (string-join (map number->string iseq) "_"))
- (name (string-append "ChSeq_" tail)))
- name))
-
-;; Convert char to string that works inside single quotes for C.
-(define (c-char ch)
- (case ch
- ((#\') "'\\''")
- ((#\\) "'\\\\'")
- ((#\newline) "'\\n'")
- ((#\tab) "'\\t'")
- ((#\return) "\\r")
- (else (string #\' ch #\'))))
-
-(define (token->bison tok)
- (cond
- ((eqv? tok '$error) "error")
- ((symbol? tok) (symbol->bison tok))
- ((char? tok) (c-char tok))
- ((string? tok)
- (cond
- ((like-c-ident? tok) (string-upcase tok))
- ((= 1 (string-length tok)) (c-char (string-ref tok 0)))
- (else (chseq->name tok))))
- (else (error "what?"))))
-
-(define (symbol->bison symb)
- (let* ((str0 (symbol->string symb))
- (str1 (re/g #f "-" str0 'pre "_" 'post))
- (str2 (re/g #f "\\$" str1 'pre "_" 'post)))
- str2))
-
-(define (elt->bison symb terms)
- (let ((term (find-terminal symb terms)))
- (if term
- (token->bison term)
- (symbol->bison symb))))
-
-;; @deffn lalr->bison spec => to current output port
-;; needs cleanup: tokens working better but p-rules need fix.
-(define (lalr->bison spec . rest)
-
- (define (setup-assc assc)
- (fold (lambda (al seed)
- (append (x-flip al) seed)) '() assc))
-
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (lhs-v (assq-ref spec 'lhs-v))
- (rhs-v (assq-ref spec 'rhs-v))
- (prp-v (assq-ref spec 'prp-v))
- (assc (setup-assc (assq-ref spec 'assc)))
- (nrule (vector-length lhs-v))
- (terms (assq-ref spec 'terminals)))
- ;; Generate copyright notice.
- (let* ((notice (assq-ref (assq-ref spec 'attr) 'notice))
- (lines (if notice (string-split notice #\newline) '())))
- (for-each (lambda (l) (fmt port "// ~A\n" l))
- lines))
- ;; Write out the tokens.
- (for-each
- (lambda (term)
- (unless (eqv? term '$error)
- (fmt port "%token ~A\n" (token->bison term))))
- terms)
- ;; Write the associativity and prececences.
- (let iter ((pl '()) (ppl (assq-ref spec 'prec)))
- (cond
- ((pair? pl)
- (fmt port "%~A" (or (assq-ref assc (caar pl)) "precedence"))
- (let iter2 ((pl (car pl)))
- (unless (null? pl)
- (fmt port " ~A" (elt->bison (car pl) terms))
- (iter2 (cdr pl))))
- (fmt port "\n")
- (iter (cdr pl) ppl))
- ((pair? ppl) (iter (car ppl) (cdr ppl)))))
- ;; Don't compact tables.
- (fmt port "%define lr.default-reduction accepting\n")
- ;; Provide start symbol.
- (fmt port "%start ~A\n%%\n" (elt->bison (lalr-start spec) terms))
- ;;
- (do ((i 1 (1+ i))) ((= i nrule))
- (let* ((lhs (vector-ref lhs-v i)) (rhs (vector-ref rhs-v i)))
- (fmt port "~A:" (elt->bison lhs terms))
- (vector-for-each
- (lambda (ix e) (fmt port " ~A" (elt->bison e terms)))
- rhs)
- (if (zero? (vector-length rhs)) (fmt port " %empty"))
- (and=> (vector-ref prp-v i)
- (lambda (tok) (fmt port " %prec ~A" (elt->bison tok terms))))
- (fmt port " ;\n")))
- (newline port)
- (values)))
-
-;; @item pp-guile-input spec => to current output port
-;; total hack right now
-(define (lalr->guile spec . rest)
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (lhs-v (assq-ref spec 'lhs-v))
- (rhs-v (assq-ref spec 'rhs-v))
- (act-v (assq-ref spec 'act-v))
- (nrule (vector-length lhs-v))
- (terms (assq-ref spec 'terminals))
- (lhsP #f))
- ;;
- (fmt port "(use-modules (system base lalr))\n")
- (fmt port "(define parser\n")
- (fmt port " (lalr-parser\n (")
- (for-each
- (lambda (s)
- (if (> (port-column port) 60) (fmt port "\n "))
- (cond
- ((equal? #\; s) (fmt port " C-semi"))
- ((symbol? s) (fmt port " ~A" s))
- (else (fmt port " C-~A" s))))
- terms)
- (fmt port ")\n")
- ;;
- (do ((i 1 (1+ i))) ((= i nrule))
- (let* ((lhs (vector-ref lhs-v i)) (rhs (vector-ref rhs-v i)))
- (if #f
- (pp-rule 0 i)
- (begin
- (if lhsP
- (if (not (eqv? lhs lhsP))
- (fmt port " )\n (~S\n" lhs))
- (fmt port " (~S\n" lhs))
- (fmt port " (")
- (do ((j 0 (1+ j) )) ((= j (vector-length rhs)))
- (let ((e (vector-ref rhs j)))
- (if (positive? j) (fmt port " "))
- (fmt
- port "~A"
- (cond
- ((equal? #\; e) (fmtstr "C-semi"))
- ((char? e) (fmtstr "C-~A" e))
- (else e)))
- ))
- (fmt port ") ")
- (fmt port ": ~S" `(begin ,@(vector-ref act-v i)))
- (fmt port "\n")
- (set! lhsP lhs)))))
- (fmt port " ))\n")
- (fmt port " )\n")
- (values)))
-
-;;; --- last line ---
+++ /dev/null
-;;; nyacc/import.scm
-;;;
-;;; Copyright (C) 2015 Matthew R. Wette
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public
-;;; License along with this library; if not, write to the Free Software
-;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-;; Convert guile lalr grammar to nyacc grammar.
-
-;; What is *eoi* for?
-
-(define-module (nyacc import)
- #:export-syntax (lalr-parser)
- #:export (guile-lalr->nyacc-lalr)
- #:use-module ((srfi srfi-1) #:select (fold-right))
- )
-
-(define (convert-tree spec0)
- (let* ((terms (cons '*eoi* (car spec0)))
- (start (caadr spec0))
- (wrap-symb
- (lambda (s) (cons (if (memq s terms) 'terminal 'non-terminal) s))))
- (let iter ((prl1 '()) ; new production rules
- (prl0 (cdr spec0)) ; old production rules
- (lhs #f) ; LHS
- (rhs1-l #f) ; new RHS list
- (rhs0-l #f)) ; old RHS list
- (cond
- ((pair? rhs0-l) ;; convert RHS
- (iter prl1 prl0 lhs
- (cons
- (fold-right ;; s1 ... : a => (('terminal . s) ... ('$$ . a))
- (lambda (symb seed) (cons (wrap-symb symb) seed))
- (list (list '$$ (cdar rhs0-l)))
- (caar rhs0-l))
- rhs1-l)
- (cdr rhs0-l)))
- ((null? rhs0-l) ;; roll up LHS+RHSs to new rule
- (iter (cons (cons lhs (reverse rhs1-l)) prl1) prl0 #f #f #f))
- ((pair? prl0) ;; next production rule
- (iter prl1 (cdr prl0) (caar prl0) '() (cdar prl0)))
- (else ;; return spec in preliminary form
- (list
- 'lalr-spec
- `(start ,start)
- `(grammar ,(reverse prl1))))))))
-
-(define-syntax parse-rhs-list
- (syntax-rules (:)
- ((_ (<rhs0sym> ...) : <rhs0act> <rhs1> ...)
- (cons (cons '(<rhs0sym> ...) '<rhs0act>)
- (parse-rhs-list <rhs1> ...)))
- ((_) (list))))
-
-(define-syntax parse-prod-list
- (syntax-rules ()
- ((_ (<lhs> <rhs> ...) <prod1> ...)
- (cons (cons '<lhs> (parse-rhs-list <rhs> ...))
- (parse-prod-list <prod1> ...)))
- ((_) (list))))
-
-
-(define-syntax lalr-parser
- (syntax-rules ()
- ((_ <tokens> <prod0> ...)
- (convert-tree
- (cons '<tokens> (parse-prod-list <prod0> ...))))))
-
-
-(define (guile-lalr->nyacc-lalr match-table spec)
- (letrec
- ((mark (lambda (s) (if (symbol? s) `(quote ,s) s)))
- (rmt (map (lambda (p) (cons (cdr p) (mark (car p)))) match-table))
- (clean
- (lambda (dt)
- (cond
- ((null? dt) '())
- ((pair? dt)
- (case (car dt)
- ((non-terminal) (cdr dt))
- ((terminal)
- (cond
- ((assq-ref rmt (cdr dt)))
- ((symbol? (cdr dt)) (simple-format #f "~A" (cdr dt)))
- (else (cdr dt))))
- ((start) dt)
- (else
- (cons (clean (car dt)) (clean (cdr dt))))))
- (else
- dt))))
- )
- (clean spec)))
-
-
-;;; --- last line ---
+++ /dev/null
-;;; nyacc/lalr.scm
-;;;
-;;; Copyright (C) 2014-2017 Matthew R. Wette
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public License
-;;; along with this library; if not, see <http://www.gnu.org/licenses/>
-
-;; I need to find way to preserve srconf, rrconf after hashify.
-;; compact needs to deal with it ...
-
-(define-module (nyacc lalr)
- #:export-syntax (lalr-spec)
- #:export (*nyacc-version*
- make-lalr-machine compact-machine hashify-machine
- lalr-start lalr-match-table
- restart-spec add-recovery-logic!
- pp-lalr-notice pp-lalr-grammar pp-lalr-machine
- write-lalr-actions write-lalr-tables
- pp-rule find-terminal gen-match-table ; used by (nyacc bison)
-
- ;; for debugging:
- with-spec make-LR0-machine
- its-member its-trans
- looking-at first-item
- terminal? non-terminal?
- range-next
- )
- #:use-module ((srfi srfi-1) #:select (fold fold-right remove lset-union
- lset-intersection lset-difference))
- #:use-module ((srfi srfi-9) #:select (define-record-type))
- #:use-module ((srfi srfi-43) #:select (vector-map vector-for-each vector-any))
- #:use-module (nyacc util)
- )
-
-(define *nyacc-version* "0.78.0")
-
-;; @deffn proxy-? sym rhs
-;; @example
-;; (LHS (($? RHS))
-;; ($P (($$ #f))
-;; ($P RHS ($$ (set-cdr! (last-pair $1) (list $2)) $1)))
-;; @end example
-(define (proxy-? sym rhs)
- (list sym
- (list '(action #f #f (list)))
- rhs))
-
-;; @deffn proxy-+ sym rhs
-;; @example
-;; (LHS (($* RHS))
-;; ($P (($$ '()))
-;; ($P RHS ($$ (set-cdr! (last-pair $1) (list $2)) $1)))
-;; @end example
-(define (proxy-* sym rhs)
- (if (pair? (filter (lambda (elt) (eqv? 'action (car elt))) rhs))
- (error "no RHS action allowed")) ;; rhs
- (list
- sym
- (list '(action #f #f (list)))
- (append (cons (cons 'non-terminal sym) rhs)
- (list '(action #f #f
- (set-cdr! (last-pair $1) (list $2))
- $1)))))
-
-;; @deffn proxy-+ sym rhs
-;; @example
-;; (LHS (($+ RHS))
-;; ($P (RHS ($$ (list $1)))
-;; ($P RHS ($$ (set-cdr! (last-pair $1) (list $2)) $1)))
-;; @end example
-(define (proxy-+ sym rhs)
- (if (pair? (filter (lambda (elt) (eq? 'action (car elt))) rhs))
- (error "no RHS action allowed")) ;; rhs
- (list
- sym
- (append rhs (list '(action #f #f (list $1))))
- (append (cons (cons 'non-terminal sym) rhs)
- (list '(action #f #f
- (set-cdr! (last-pair $1) (list $2))
- $1)))))
-
-;; @deffn reserved? grammar-symbol
-;; Determine whether the syntax argument is a reserved symbol, that is.
-;; So instead of writing @code{'$fixed} for syntax one can write
-;; @code{$fixed}. We may want to change this to
-;; @example
-;; (reserved-terminal? grammar-symbol)
-;; (reserved-non-term? grammar-symbol)
-;; @end example
-(define (reserved? grammar-symbol)
- ;; If the first character `$' then it's reserved.
- (eqv? #\$ (string-ref (symbol->string (syntax->datum grammar-symbol)) 0)))
-
-;; @deffn {Syntax} lalr-spec grammar => spec
-;; This routine reads a grammar in a scheme-like syntax and returns an a-list.
-;; This spec' can be an input for @item{make-parser-generator} or
-;; @item{pp-spec}.
-;;.This will return the specification. Notably the grammar will have rhs
-;; arguments decorated with type (e.g., @code{(terminal . #\,)}).
-;; Each production rule in the grammar will be of the form
-;; @code{(lhs rhs1 rhs2 ...)} where each element of the RHS is one of
-;; @itemize
-;; @item @code{('terminal . atom)}
-;; @item @code{('non-terminal . symbol)}
-;; @item @code{('action . (ref narg guts)}
-;; @item @code{('proxy . production-rule)}
-;; @end itemize
-;; Currently, the number of arguments for items is computed in the routine
-;; @code{process-grammar}.
-;; @end deffn
-(define-syntax lalr-spec
- (syntax-rules +++ ()
- ((_ <expr> +++)
- (let* ()
- (letrec-syntax
- ((with-attr-list
- (syntax-rules ($prune)
- ((_ ($prune <symb>) <ex> ...)
- (cons '(prune . <symb>) (with-attr-list <ex> ...)))
- ((_) '())))
- (parse-rhs
- (lambda (x)
- ;; The following is syntax-case because we use a fender.
- (syntax-case x (quote $$ $$/ref $$-ref $prec $with $empty
- $? $* $+)
- ;; action specifications
- ((_ ($$ <guts> ...) <e2> ...)
- #'(cons '(action #f #f <guts> ...) (parse-rhs <e2> ...)))
- ((_ ($$-ref <ref>) <e2> ...)
- ;;#'(cons '(action #f <ref> #f) (parse-rhs <e2> ...)))
- #'(cons `(action #f ,<ref> . #f) (parse-rhs <e2> ...)))
- ((_ ($$/ref <ref> <guts> ...) <e2> ...)
- #'(cons `(action #f ,<ref> <guts> ...) (parse-rhs <e2> ...)))
-
- ;; other internal $-syntax
- ((_ ($prec <tok>) <e2> ...)
- #'(cons (cons 'prec (tokenize <tok>)) (parse-rhs <e2> ...)))
- ((_ ($with <lhs-ref> <ex> ...) <e2> ...)
- #'(cons `(with <lhs-ref> ,@(with-attr-list <ex> ...))
- (parse-rhs <e2> ...)))
- ((_ $empty <e2> ...) ; TODO: propagate to processor
- #'(parse-rhs <e2> ...))
-
- ;; (experimental) proxies
- ((_ ($? <s1> <s2> ...) <e2> ...)
- #'(cons (cons* 'proxy proxy-? (parse-rhs <s1> <s2> ...))
- (parse-rhs <e2> ...)))
- ((_ ($+ <s1> <s2> ...) <e2> ...)
- #'(cons (cons* 'proxy proxy-+ (parse-rhs <s1> <s2> ...))
- (parse-rhs <e2> ...)))
- ((_ ($* <s1> <s2> ...) <e2> ...)
- #'(cons (cons* 'proxy proxy-* (parse-rhs <s1> <s2> ...))
- (parse-rhs <e2> ...)))
-
- ;; terminals and non-terminals
- ((_ (quote <e1>) <e2> ...)
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...)))
- ((_ (<f> ...) <e2> ...)
- #'(cons (<f> ...) (parse-rhs <e2> ...)))
- ((_ <e1> <e2> ...)
- (identifier? (syntax <e1>)) ; fender to trap non-term's
- (if (reserved? (syntax <e1>))
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...))
- #'(cons '(non-terminal . <e1>) (parse-rhs <e2> ...))))
- ((_ <e1> <e2> ...)
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...)))
- ((_) #'(list)))))
- (parse-rhs-list
- (syntax-rules ()
- ((_ (<ex> ...) <rhs> ...)
- (cons (parse-rhs <ex> ...)
- (parse-rhs-list <rhs> ...)))
- ((_) '())))
- (parse-grammar
- (syntax-rules ()
- ((_ (<lhs> <rhs> ...) <prod> ...)
- (cons (cons '<lhs> (parse-rhs-list <rhs> ...))
- (parse-grammar <prod> ...)))
- ((_) '())))
- (tokenize
- (lambda (x)
- (syntax-case x ()
- ((_ <tk>) (identifier? (syntax <tk>)) #'(quote <tk>))
- ((_ <tk>) #'<tk>))))
- (tokenize-list
- (syntax-rules ()
- ((_ <tk1> <tk2> ...)
- (cons (tokenize <tk1>) (tokenize-list <tk2> ...)))
- ((_) '())))
- (parse-precedence
- (syntax-rules (left right nonassoc)
- ((_ (left <tk> ...) <ex> ...)
- (cons (cons 'left (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ (right <tk> ...) <ex> ...)
- (cons (cons 'right (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ (nonassoc <tk> ...) <ex> ...)
- (cons (cons 'nonassoc (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ <tk> <ex> ...)
- (cons (list 'undecl (tokenize <tk>))
- (parse-precedence <ex> ...)))
- ((_) '())))
- (lalr-spec-1
- (syntax-rules (start expect notice prec< prec> grammar)
- ((_ (start <symb>) <e> ...)
- (cons (cons 'start '<symb>) (lalr-spec-1 <e> ...)))
- ((_ (expect <n>) <e> ...)
- (cons (cons 'expect <n>) (lalr-spec-1 <e> ...)))
- ((_ (notice <str>) <e> ...)
- (cons (cons 'notice <str>) (lalr-spec-1 <e> ...)))
- ((_ (prec< <ex> ...) <e> ...)
- (cons (cons 'precedence (parse-precedence <ex> ...))
- (lalr-spec-1 <e> ...)))
- ((_ (prec> <ex> ...) <e> ...)
- (cons (cons 'precedence (reverse (parse-precedence <ex> ...)))
- (lalr-spec-1 <e> ...)))
- ((_ (grammar <prod> ...) <e> ...)
- (cons (cons 'grammar (parse-grammar <prod> ...))
- (lalr-spec-1 <e> ...)))
- ((_) '()))))
- (process-spec (lalr-spec-1 <expr> +++)))))))
-
-;; @deffn atomize terminal => object
-;; Generate an atomic object for a terminal. Expected terminals are strings,
-;; characters and symbols. This will convert the strings @code{s} to symbols
-;; of the form @code{'$:s}.
-(define (atomize terminal)
- (if (string? terminal)
- (string->symbol (string-append "$:" terminal))
- terminal))
-
-;; @deffn normize terminal => char|symbol
-;; Normalize a token. This routine will normalize tokens in order to check
-;; for similarities. For example, @code{"+"} and @code{#\+} are similar,
-;; @code{'foo} and @code{"foo"} are similar.
-(define (normize terminal)
- (if (not (string? terminal)) terminal
- (if (= 1 (string-length terminal))
- (string-ref terminal 0)
- (string->symbol terminal))))
-
-;; @deffn eqv-terminal? a b
-;; This is a predicate to determine if the terminals @code{a} and @code{b}
-;; are equivalent.
-(define (eqv-terminal? a b)
- (eqv? (atomize a) (atomize b)))
-
-;; @deffn find-terminal symb term-l => term-symb
-;; Find the terminal in @code{term-l} that is equivalent to @code{symb}.
-(define (find-terminal symb term-l)
- (let iter ((tl term-l))
- (if (null? tl) #f
- (if (eqv-terminal? symb (car tl)) (car tl)
- (iter (cdr tl))))))
-
-;; @deffn process-spec tree => specification (as a-list)
-;; Here we sweep through the production rules. We flatten and order the rules
-;; and place all p-rules with like LHSs together. There is a non-trivial
-;; amount of extra code to deal with mid-rule actions (MRAs).
-(define (process-spec tree)
-
- ;; Make a new symbol. This is a helper for proxies and mid-rule-actions.
- ;; The counter here is the only @code{set!} in @code{process-spec}.
- ;; Otherwise, I believe @code{process-spec} is referentially transparent.
- (define maksy
- (let ((cntr 1))
- (lambda ()
- (let ((c cntr))
- (set! cntr (1+ cntr))
- (string->symbol (string-append "$P" (number->string c)))))))
-
- ;; Canonicalize precedence and associativity. Precedence will appear
- ;; as sets of equivalent items in increasing order of precedence
- ;; (e.g., @code{((+ -) (* /)}). The input tree has nodes that look like
- ;; @example
- ;; '(precedence (left "+" "-") (left "*" "/"))
- ;; '(precedence ('then "else")
- ;; @end example
- ;; @noindent
- ;; =>
- ;; @example
- ;; (prec ((+ -) (* /)) ((then) (else)))
- ;; @end example
- (define (prec-n-assc tree)
- ;; prec-l; lt-assc-l rt-assc-l non-assc-l pspec
- (let iter ((pll '()) (pl '()) (la '()) (ra '()) (na '())
- (spec '()) (tree tree))
- (cond
- ((pair? spec)
- ;; item ~ ('left "+" "-") => a ~ 'left, tl ~ (#\+ #\-)
- (let* ((item (car spec)) (as (car item)) (tl (map atomize (cdr item))))
- (case as
- ((left)
- (iter pll (cons tl pl) (append tl la) ra na (cdr spec) tree))
- ((right)
- (iter pll (cons tl pl) la (append tl ra) na (cdr spec) tree))
- ((nonassoc)
- (iter pll (cons tl pl) la ra (append tl na) (cdr spec) tree))
- ((undecl)
- (iter pll (cons tl pl) la ra na (cdr spec) tree)))))
- ((pair? pl)
- (iter (cons (reverse pl) pll) '() la ra na spec tree))
- ((pair? tree)
- (iter pll pl la ra na
- (if (eqv? 'precedence (caar tree)) (cdar tree) '()) (cdr tree)))
- (else
- (list
- `(prec . ,(reverse pll))
- `(assc (left ,@la) (right ,@ra) (nonassoc ,@na)))))))
-
- ;;.@deffn make-mra-proxy sy pel act => ???
- ;; Generate a mid-rule-action proxy.
- (define (make-mra-proxy sy pel act)
- (list sy (list (cons* 'action (length pel) (cdr act)))))
-
- ;; @deffn gram-check-2 tl nl err-l
- ;; Check for fatal: symbol used as terminal and non-terminal.
- (define (gram-check-2 tl nl err-l)
- (let ((cf (lset-intersection eqv? (map atomize tl) nl)))
- (if (pair? cf)
- (cons (fmtstr "*** symbol is terminal and non-terminal: ~S" cf)
- err-l) err-l)))
-
- ;; @deffn gram-check-3 ll nl err-l
- ;; Check for fatal: non-terminal's w/o production rule.
- (define (gram-check-3 ll nl err-l)
- (fold
- (lambda (n l)
- (if (not (memq n ll))
- (cons (fmtstr "*** non-terminal with no production rule: ~A" n) l)
- l))
- err-l nl))
-
- ;; @deffn gram-check-4 ll nl err-l
- ;; Check for warning: unused LHS.
- ;; TODO: which don't appear in OTHER RHS, e.g., (foo (foo))
- (define (gram-check-4 ll nl err-l)
- (fold
- (lambda (s l) (cons (fmtstr "+++ LHS not used in any RHS: ~A" s) l))
- err-l
- (let iter ((ull '()) (all ll)) ; unused LHSs, all LHS's
- (if (null? all) ull
- (iter (if (or (memq (car all) nl)
- (memq (car all) ull)
- (eq? (car all) '$start))
- ull (cons (car all) ull))
- (cdr all))))))
-
- ;; TODO: check for repeated tokens in precedence spec's: prec<, prec>
-
- (let* ((gram (assq-ref tree 'grammar))
- (start-symbol (and=> (assq-ref tree 'start) atomize))
- (start-rule (lambda () (list start-symbol)))
- (add-el (lambda (e l) (if (member e l) l (cons e l))))
- (pna (prec-n-assc tree)))
- ;; We sweep through the grammar to generate a canonical specification.
- ;; Note: the local rhs is used to hold RHS terms, but a
- ;; value of @code{'()} is used to signal "add rule", and a value of
- ;; @code{#f} is used to signal ``done, proceed to next rule.''
- ;; We use @code{tail} below to go through all remaining rules so that any
- ;; like LHS get absorbed before proceeding: This keeps LHS in sequence.
- ;; Note: code-comm and lone-comm are added to terminals so that they end
- ;; up in the match-table. The parser will skip these if the automoton has
- ;; no associated transitions for these. This allows users to parse for
- ;; comments in some rules but skip the rest.
- (let iter ((ll '($start)) ; LHS list
- (@l (list ; attributes per prod' rule
- `((rhs . ,(vector start-symbol))
- (ref . all) (act 1 $1))))
- (tl '($code-comm $lone-comm $error $end)) ; set of terminals
- (nl (list start-symbol)) ; set of non-terminals
- ;;
- (head gram) ; head of unprocessed productions
- (prox '()) ; proxy productions for MRA
- (lhs #f) ; current LHS (symbol)
- (tail '()) ; tail of grammar productions
- (rhs-l '()) ; list of RHSs being processed
- (attr '()) ; per-rule attributes (action, prec)
- (pel '()) ; processed RHS terms: '$:if ...
- (rhs #f)) ; elts to process: (terminal . '$:if) ...
- (cond
- ((pair? rhs)
- ;; Capture info on RHS term.
- (case (caar rhs)
- ((terminal)
- (iter ll @l (add-el (cdar rhs) tl) nl head prox lhs tail
- rhs-l attr (cons (atomize (cdar rhs)) pel) (cdr rhs)))
- ((non-terminal)
- (iter ll @l tl (add-el (cdar rhs) nl) head prox lhs tail
- rhs-l attr (cons (cdar rhs) pel) (cdr rhs)))
- ((action)
- (if (pair? (cdr rhs))
- ;; mid-rule action: generate a proxy (car act is # args)
- (let* ((sy (maksy))
- (pr (make-mra-proxy sy pel (cdar rhs))))
- (iter ll @l tl (cons sy nl) head (cons pr prox)
- lhs tail rhs-l attr (cons sy pel) (cdr rhs)))
- ;; end-rule action
- (iter ll @l tl nl head prox lhs tail
- rhs-l (acons 'action (cdar rhs) attr) pel (cdr rhs))))
- ((proxy)
- (let* ((sy (maksy))
- (pf (cadar rhs)) ; proxy function
- (p1 (pf sy (cddar rhs))))
- (iter ll @l tl (cons sy nl) head (cons p1 prox) lhs
- tail rhs-l attr (cons sy pel) (cdr rhs))))
- ((prec)
- (iter ll @l (add-el (cdar rhs) tl) nl head prox lhs tail rhs-l
- (acons 'prec (atomize (cdar rhs)) attr) pel (cdr rhs)))
- ((with)
- (let* ((psy (maksy)) ; proxy symbol
- (rhsx (cadar rhs)) ; symbol to expand
- (p-l (map cdr (cddar rhs))) ; prune list
- (p1 (list psy `((non-terminal . ,rhsx)
- (action #f #f $1)))))
- (iter ll @l tl (cons psy nl) head (cons p1 prox) lhs tail rhs-l
- (acons 'with (cons psy p-l) attr) (cons psy pel) (cdr rhs))))
- (else
- (error (fmtstr "bug=~S" (caar rhs))))))
-
- ((null? rhs)
- ;; End of RHS items for current rule.
- ;; Add the p-rules items to the lists ll, rl, xl, and @@l.
- ;; @code{act} is now:
- ;; @itemize
- ;; @item for mid-rule-action: (narg ref code)
- ;; @item for end-rule-action: (#f ref code)
- ;; @end itemize
- (let* ((ln (length pel))
- (action (assq-ref attr 'action))
- (with (assq-ref attr 'with))
- (nrg (if action (or (car action) ln) ln)) ; number of args
- (ref (if action (cadr action) #f))
- (act (cond
- ((and action (cddr action)) (cddr action))
- ;; if error rule then default action is print err msg:
- ((memq '$error pel) '((display "syntax error\n")))
- ((zero? nrg) '((list)))
- (else '($1)))))
- (if with (simple-format #t "WITH WHAT?\n"))
- (iter (cons lhs ll)
- (cons (cons* (cons 'rhs (list->vector (reverse pel)))
- (cons* 'act nrg act) (cons 'ref ref) attr) @l)
- tl nl head prox lhs tail rhs-l attr pel #f)))
-
- ((pair? rhs-l)
- ;; Work through next RHS.
- (iter ll @l tl nl head prox lhs tail
- (cdr rhs-l) '() '() (car rhs-l)))
-
- ((pair? tail)
- ;; Check the next CAR of the tail. If it matches
- ;; the current LHS process it, else skip it.
- (iter ll @l tl nl head prox lhs (cdr tail)
- (if (eqv? (caar tail) lhs) (cdar tail) '())
- attr pel #f))
-
- ((pair? prox)
- ;; If a proxy then we have ((lhs RHS) (lhs RHS))
- (iter ll @l tl nl (cons (car prox) head) (cdr prox)
- lhs tail rhs-l attr pel rhs))
-
- ((pair? head)
- ;; Check the next rule-set. If the lhs has aready
- ;; been processed, then skip. Otherwise, copy copy
- ;; to tail and process.
- (let ((lhs (caar head)) (rhs-l (cdar head))
- (rest (cdr head)))
- (if (memq lhs ll)
- (iter ll @l tl nl rest prox #f '() '() attr pel #f)
- (iter ll @l tl nl rest prox lhs rest rhs-l attr pel rhs))))
-
- (else
- (let* ((al (reverse @l)) ; attribute list
- (err-1 '()) ;; not used
- ;; symbol used as terminal and non-terminal:
- (err-2 (gram-check-2 tl nl err-1))
- ;; non-terminal's w/o production rule:
- (err-3 (gram-check-3 ll nl err-2))
- ;; TODO: which don't appear in OTHER RHS, e.g., (foo (foo))
- (err-4 (gram-check-4 ll nl err-3))
- ;; todo: Check that with withs are not mixed
- (err-l err-4))
- (for-each (lambda (e) (fmterr "~A\n" e)) err-l)
- (if (pair? (filter (lambda (s) (char=? #\* (string-ref s 0))) err-l))
- #f
- (list
- ;; Put most referenced items first, but keep start and rhs-v at
- ;; top so that if we want to restart (see restart-spec) we can
- ;; reuse the tail here.
- ;;(cons 'start start-symbol) ; use lalr-start, aka rhs-v[0][0]
- (cons 'rhs-v (map-attr->vector al 'rhs))
- ;;
- (cons 'restart-tail #t) ; see @code{restart-spec} below
- (cons 'lhs-v (list->vector (reverse ll)))
- (cons 'non-terms nl)
- (cons 'terminals tl)
- (cons 'attr (list
- (cons 'expect (or (assq-ref tree 'expect) 0))
- (cons 'notice (assq-ref tree 'notice))))
- (cons 'prec (assq-ref pna 'prec)) ; lowest-to-highest
- (cons 'assc (assq-ref pna 'assc))
- (cons 'prp-v (map-attr->vector al 'prec)) ; per-rule precedence
- (cons 'act-v (map-attr->vector al 'act))
- (cons 'ref-v (map-attr->vector al 'ref)) ; action references
- (cons 'err-l err-l)
- ))))))))
-
-;;; === Code for processing the specification. ================================
-
-;; @subsubheading Note
-;; The fluid @code{*lalr-core*} is used during the machine generation
-;; cycles to access core parameters of the specification. This includes
-;; the list of non-terminals, the vector of left-hand side symbols and the
-;; vector of vector of right-hand side symbols.
-(define *lalr-core* (make-fluid #f))
-
-;; @deffn {Procedure} lalr-start spec => symbol
-;; Return the start symbol for the grammar.
-;; @end deffn
-(define (lalr-start spec)
- (vector-ref (vector-ref (assq-ref spec 'rhs-v) 0) 0))
-
-;; This record holds the minimum data from the grammar needed to build the
-;; machine from the grammar specification.
-(define-record-type lalr-core-type
- ;;(make-lalr-core non-terms terminals start lhs-v rhs-v eps-l)
- (make-lalr-core non-terms terminals lhs-v rhs-v eps-l)
- lalr-core-type?
- (non-terms core-non-terms) ; list of non-terminals
- (terminals core-terminals) ; list of non-terminals
- (lhs-v core-lhs-v) ; vec of left hand sides
- (rhs-v core-rhs-v) ; vec of right hand sides
- (eps-l core-eps-l)) ; non-terms w/ eps prod's
-
-;; @deffn make-core spec => lalr-core-type
-(define (make-core spec)
- (make-lalr-core (assq-ref spec 'non-terms)
- (assq-ref spec 'terminals)
- (assq-ref spec 'lhs-v)
- (assq-ref spec 'rhs-v)
- '()))
-
-;; @deffn make-core/extras spec => lalr-core-type
-;; Add list of symbols with epsilon productions.
-(define (make-core/extras spec)
- (let ((non-terms (assq-ref spec 'non-terms))
- (terminals (assq-ref spec 'terminals))
- (lhs-v (assq-ref spec 'lhs-v))
- (rhs-v (assq-ref spec 'rhs-v)))
- (make-lalr-core non-terms terminals lhs-v rhs-v
- (find-eps non-terms lhs-v rhs-v))))
-
-
-;; @section Routines
-
-;; @deffn <? a b po => #t | #f
-;; Given tokens @code{a} and @code{b} and partial ordering @code{po} report
-;; if precedence of @code{b} is greater than @code{a}?
-(define (<? a b po)
- (if (member (cons a b) po) #t
- (let iter ((po po))
- (if (null? po) #f
- (if (and (eqv? (caar po) a)
- (<? (cdar po) b po))
- #t
- (iter (cdr po)))))))
-
-;; @deffn prece a b po
-;; Return precedence for @code{a,b} given the partial order @code{po} as
-;; @code{#\<}, @code{#\>}, @code{#\=} or @code{#f}.
-;; This is not a true partial order as we can have a<b and b<a => a=b.
-;; @example
-;; @code{(prece a a po)} => @code{#\=}.
-;; @end example
-(define (prece a b po)
- (cond
- ((eqv? a b) #\=)
- ((eqv? a '$error) #\<)
- ((eqv? b '$error) #\>)
- ((<? a b po) (if (<? b a po) #\= #\<))
- (else (if (<? b a po) #\> #f))))
-
-;; @deffn non-terminal? symb
-(define (non-terminal? symb)
- (cond
- ((eqv? symb '$epsilon) #t)
- ((eqv? symb '$end) #f)
- ((eqv? symb '$@) #f)
- ((string? symb) #f)
- (else
- (memq symb (core-non-terms (fluid-ref *lalr-core*))))))
-
-;; @deffn terminal? symb
-(define (terminal? symb)
- (not (non-terminal? symb)))
-
-;; @deffn prule-range lhs => (start-ix . (1+ end-ix))
-;; Find the range of productiion rules for the lhs.
-;; If not found raise error.
-(define (prule-range lhs)
- ;; If this needs to be really fast then we move to where lhs is an integer
- ;; and that used to index into a table that provides the ranges.
- (let* ((core (fluid-ref *lalr-core*))
- (lhs-v (core-lhs-v core))
- (n (vector-length lhs-v))
- (match? (lambda (ix symb) (eqv? (vector-ref lhs-v ix) symb))))
- (cond
- ((terminal? lhs) '())
- ((eq? lhs '$epsilon) '())
- (else
- (let iter-st ((st 0))
- ;; Iterate to find the start index.
- (if (= st n) '() ; not found
- (if (match? st lhs)
- ;; Start found, now iteratate to find end index.
- (let iter-nd ((nd st))
- (if (= nd n) (cons st nd)
- (if (not (match? nd lhs)) (cons st nd)
- (iter-nd (1+ nd)))))
- (iter-st (1+ st)))))))))
-
-;; @deffn range-next rng -> rng
-;; Given a range in the form of @code{(cons start (1+ end))} return the next
-;; value or '() if at end. That is @code{(3 . 4)} => @code{'()}.
-(define (range-next rng)
- (if (null? rng) '()
- (let ((nxt (cons (1+ (car rng)) (cdr rng))))
- (if (= (car nxt) (cdr nxt)) '() nxt))))
-
-;; @deffn range-last? rng
-;; Predicate to indicate last p-rule in range.
-;; If off end (i.e., null rng) then #f.
-(define (range-last? rng)
- (and (pair? rng) (= (1+ (car rng)) (cdr rng))))
-
-;; @deffn lhs-symb prod-ix
-;; Return the LHS symbol for the production at index @code{prod-id}.
-(define (lhs-symb gx)
- (vector-ref (core-lhs-v (fluid-ref *lalr-core*)) gx))
-
-;; @deffn looking-at (p-rule-ix . rhs-ix)
-;; Return symbol we are looking at for this item state.
-;; If at the end (position = -1) (or rule is zero-length) then return
-;; @code{'$epsilon}.
-(define (looking-at item)
- (let* ((core (fluid-ref *lalr-core*))
- (rhs-v (core-rhs-v core))
- (rule (vector-ref rhs-v (car item))))
- (if (last-item? item)
- '$epsilon
- (vector-ref rule (cdr item)))))
-
-;; @deffn first-item gx
-;; Given grammar rule index return the first item.
-;; This will return @code{(gx . 0)}, or @code{(gx . -1)} if the rule has
-;; no RHS elements.
-(define (first-item gx)
- (let* ((core (fluid-ref *lalr-core*))
- (rlen (vector-length (vector-ref (core-rhs-v core) gx))))
- (cons gx (if (zero? rlen) -1 0))))
-
-;; @deffn last-item? item
-;; Predictate to indicate last item in (or end of) production rule.
-(define (last-item? item)
- (negative? (cdr item)))
-
-;; @deffn next-item item
-;; Return the next item in the production rule.
-;; A position of @code{-1} means the end. If at end, then @code{'()}
-(define (next-item item)
- (let* ((core (fluid-ref *lalr-core*))
- (gx (car item)) (rx (cdr item)) (rxp1 (1+ rx))
- (rlen (vector-length (vector-ref (core-rhs-v core) gx))))
- (cond
- ((negative? rx) '())
- ((eqv? rxp1 rlen) (cons gx -1))
- (else (cons gx rxp1)))))
-
-;; @deffn prev-item item
-;; Return the previous item in the grammar.
-;; prev (0 . 0) is currently (0 . 0)
-(define (prev-item item)
- (let* ((core (fluid-ref *lalr-core*))
- (rhs-v (core-rhs-v core))
- (p-ix (car item))
- (p-ixm1 (1- p-ix))
- (r-ix (cdr item))
- (r-ixm1 (if (negative? r-ix)
- (1- (vector-length (vector-ref rhs-v p-ix)))
- (1- r-ix))))
- (if (zero? r-ix)
- (if (zero? p-ix) item ; start, i.e., (0 . 0)
- (cons p-ixm1 -1)) ; prev p-rule
- (cons p-ix r-ixm1))))
-
-;; @deffn error-rule? gx => #t|#f
-;; Predicate to indicate if gx rule has @code{$error} as rhs member.
-(define (error-rule? gx)
- (let* ((core (fluid-ref *lalr-core*))
- (rhs-v (core-rhs-v core)))
- (vector-any (lambda (e) (eqv? e '$error)) (vector-ref rhs-v gx))))
-
-;; @deffn non-kernels symb => list of prule indices
-;; Compute the set of non-kernel rules for symbol @code{symb}. If grammar
-;; looks like
-;; @example
-;; 1: A => Bcd
-;; ...
-;; 5: B => Cde
-;; ...
-;; 7: B => Abe
-;; @end example
-;; @noindent
-;; then @code{non-kernels 'A} results in @code{(1 5 7)}.
-;; Note: To support pruning this routine will need to be rewritten.
-(define (non-kernels symb)
- (let* ((core (fluid-ref *lalr-core*))
- (lhs-v (core-lhs-v core))
- (rhs-v (core-rhs-v core))
- (glen (vector-length lhs-v))
- (lhs-symb (lambda (gx) (vector-ref lhs-v gx))))
- (let iter ((rslt '()) ; result is set of p-rule indices
- (done '()) ; symbols completed or queued
- (next '()) ; next round of symbols to process
- (curr (list symb)) ; this round of symbols to process
- (gx 0)) ; p-rule index
- (cond
- ((< gx glen)
- (cond
- ((memq (lhs-symb gx) curr)
- ;; Add rhs to next and rslt if not already done.
- (let* ((rhs1 (looking-at (first-item gx))) ; 1st-RHS-sym|$eps
- (rslt1 (if (memq gx rslt) rslt (cons gx rslt)))
- (done1 (if (memq rhs1 done) done (cons rhs1 done)))
- (next1 (cond ((memq rhs1 done) next)
- ((terminal? rhs1) next)
- (else (cons rhs1 next)))))
- (iter rslt1 done1 next1 curr (1+ gx))))
- (else
- ;; Nothing to check; process next rule.
- (iter rslt done next curr (1+ gx)))))
- ((pair? next)
- ;; Start another sweep throught the grammar.
- (iter rslt done '() next 0))
- (else
- ;; Done, so return.
- (reverse rslt))))))
-
-;; @deffn expand-k-item => item-set
-;; Expand a kernel-item into a list with the non-kernels.
-(define (expand-k-item k-item)
- (reverse
- (fold (lambda (gx items) (cons (first-item gx) items))
- (list k-item)
- (non-kernels (looking-at k-item)))))
-
-;; @deffn its-equal?
-;; Helper for step1
-(define (its-equal? its-1 its-2)
- (let iter ((its1 its-1) (its2 its-2)) ; cdr to strip off the ind
- (if (and (null? its1) (null? its2)) #t ; completed run through => #f
- (if (or (null? its1) (null? its2)) #f ; lists not equal length => #f
- (if (not (member (car its1) its-2)) #f ; mismatch => #f
- (iter (cdr its1) (cdr its2)))))))
-
-;; @deffn its-member its its-l
-;; Helper for step1
-;; If itemset @code{its} is a member of itemset list @code{its-l} return the
-;; index, else return #f.
-(define (its-member its its-l)
- (let iter ((itsl its-l))
- (if (null? itsl) #f
- (if (its-equal? its (cdar itsl)) (caar itsl)
- (iter (cdr itsl))))))
-
-;; @deffn its-trans itemset => alist of (symb . itemset)
-;; Compute transitions from an itemset. Thatis, map a list of kernel
-;; items to a list of (symbol post-shift items).
-;; @example
-;; ((0 . 1) (2 . 3) => ((A (0 . 2) (2 . 4)) (B (2 . 4) ...))
-;; @end example
-(define (its-trans items)
- (let iter ((rslt '()) ; result
- (k-items items) ; items
- (itl '())) ; one k-item w/ added non-kernels
- (cond
- ((pair? itl)
- (let* ((it (car itl)) ; item
- (sy (looking-at it)) ; symbol
- (nx (next-item it))
- (sq (assq sy rslt))) ; if we have seen it
- (cond
- ((eq? sy '$epsilon)
- ;; don't transition end-of-rule items
- (iter rslt k-items (cdr itl)))
- ((not sq)
- ;; haven't seen this symbol yet
- (iter (acons sy (list nx) rslt) k-items (cdr itl)))
- ((member nx (cdr sq))
- ;; repeat
- (iter rslt k-items (cdr itl)))
- (else
- ;; SY is in RSLT and item not yet in: add it.
- (set-cdr! sq (cons nx (cdr sq)))
- (iter rslt k-items (cdr itl))))))
- ((pair? k-items)
- (iter rslt (cdr k-items) (expand-k-item (car k-items))))
- (else
- rslt))))
-
-;; @deffn step1 [input-a-list] => p-mach-1
-;; Compute the sets of LR(0) kernel items and the transitions associated with
-;; spec. These are returned as vectors in the alist with keys @code{'kis-v}
-;; and @code{'kix-v}, repspectively. Each entry in @code{kis-v} is a list of
-;; items in the form @code{(px . rx)} where @code{px} is the production rule
-;; index and @code{rx} is the index of the RHS symbol. Each entry in the
-;; vector @code{kix-v} is an a-list with entries @code{(sy . kx)} where
-;; @code{sy} is a (terminal or non-terminal) symbol and @code{kx} is the
-;; index of the kernel itemset. The basic algorithm is discussed on
-;; pp. 228-229 of the DB except that we compute non-kernel items on the fly
-;; using @code{expand-k-item}. See Example 4.46 on p. 241 of the DB.
-(define (step1 . rest)
- (let* ((al-in (if (pair? rest) (car rest) '()))
- (add-kset (lambda (upd kstz) ; give upd a ks-ix and add to kstz
- (acons (1+ (caar kstz)) upd kstz)))
- (init '(0 (0 . 0))))
- (let iter ((ksets (list init)) ; w/ index
- (ktrnz '()) ; ((symb src dst) (symb src dst) ...)
- (next '()) ; w/ index
- (todo (list init)) ; w/ index
- (curr #f) ; current state ix
- (trans '())) ; ((symb it1 it2 ...) (symb ...))
- (cond
- ((pair? trans)
- ;; Check next symbol for transitions (symb . (item1 item2 ...)).
- (let* ((dst (cdar trans)) ; destination item
- (dst-ix (its-member dst ksets)) ; return ix else #f
- (upd (if dst-ix '() (cons (1+ (caar ksets)) dst)))
- (ksets1 (if dst-ix ksets (cons upd ksets)))
- (next1 (if dst-ix next (cons upd next)))
- (dsx (if dst-ix dst-ix (car upd))) ; dest state index
- (ktrnz1 (cons (list (caar trans) curr dsx) ktrnz)))
- (iter ksets1 ktrnz1 next1 todo curr (cdr trans))))
- ((pair? todo)
- ;; Process the next state (aka itemset).
- (iter ksets ktrnz next (cdr todo) (caar todo) (its-trans (cdar todo))))
- ((pair? next)
- ;; Sweep throught the grammar again.
- (iter ksets ktrnz '() next curr '()))
- (else
- (let* ((nkis (length ksets)) ; also (caar ksets)
- (kisv (make-vector nkis #f))
- (kitv (make-vector nkis '())))
- ;; Vectorize kernel sets
- (for-each
- (lambda (kis) (vector-set! kisv (car kis) (cdr kis)))
- ksets)
- ;; Vectorize transitions (by src kx).
- (for-each
- (lambda (kit)
- (vector-set! kitv (cadr kit)
- (acons (car kit) (caddr kit)
- (vector-ref kitv (cadr kit)))))
- ktrnz)
- ;; Return kis-v, kernel itemsets, and kix-v transitions.
- (cons* (cons 'kis-v kisv) (cons 'kix-v kitv) al-in)))))))
-
-;; @deffn find-eps non-terms lhs-v rhs-v => eps-l
-;; Generate a list of non-terminals which have epsilon productions.
-(define (find-eps nterms lhs-v rhs-v)
- (let* ((nprod (vector-length lhs-v))
- (find-new
- (lambda (e l)
- (let iter ((ll l) (gx 0) (lhs #f) (rhs #()) (rx 0))
- (cond
- ((< rx (vector-length rhs))
- (if (and (memq (vector-ref rhs rx) nterms) ; non-term
- (memq (vector-ref rhs rx) ll)) ; w/ eps prod
- (iter ll gx lhs rhs (1+ rx)) ; yes: check next
- (iter ll (1+ gx) #f #() 0))) ; no: next p-rule
- ((and lhs (= rx (vector-length rhs))) ; we have eps-prod
- (iter (if (memq lhs ll) ll (cons lhs ll)) (1+ gx) #f #() 0))
- ((< gx nprod) ; check next p-rule if not on list
- (if (memq (vector-ref lhs-v gx) ll)
- (iter ll (1+ gx) #f #() 0)
- (iter ll gx (vector-ref lhs-v gx) (vector-ref rhs-v gx) 0)))
- (else ll))))))
- (fixed-point find-new (find-new #f '()))))
-
-;; @deffn merge1 v l
-;; add v to l if not in l
-(define (merge1 v l)
- (if (memq v l) l (cons v l)))
-
-;; @deffn merge2 v l al
-;; add v to l if not in l or al
-(define (merge2 v l al)
- (if (memq v l) l (if (memq v al) l (cons v l))))
-
-;; @deffn first symbol-list end-token-list
-;; Return list of terminals starting the string @code{symbol-list}
-;; (see DB, p. 188). If the symbol-list can generate epsilon then the
-;; result will include @code{end-token-list}.
-(define (first symbol-list end-token-list)
- (let* ((core (fluid-ref *lalr-core*))
- (eps-l (core-eps-l core)))
- ;; This loop strips off the leading symbol from stng and then adds to
- ;; todo list, which results in range of p-rules getting checked for
- ;; terminals.
- (let iter ((rslt '()) ; terminals collected
- (stng symbol-list) ; what's left of input string
- (hzeps #t) ; if eps-prod so far
- (done '()) ; non-terminals checked
- (todo '()) ; non-terminals to assess
- (p-range '()) ; range of p-rules to check
- (item '())) ; item in production
- (cond
- ((pair? item)
- (let ((sym (looking-at item)))
- (cond
- ((eq? sym '$epsilon) ; at end of rule, go next
- (iter rslt stng hzeps done todo p-range '()))
- ((terminal? sym) ; terminal, log it
- (iter (merge1 sym rslt) stng hzeps done todo p-range '()))
- ((memq sym eps-l) ; symbol has eps prod
- (iter rslt stng hzeps (merge1 sym done) (merge2 sym todo done)
- p-range (next-item item)))
- (else ;; non-terminal, add to todo/done, goto next
- (iter rslt stng hzeps
- (merge1 sym done) (merge2 sym todo done) p-range '())))))
-
- ((pair? p-range) ; next one to do
- ;; run through next rule
- (iter rslt stng hzeps done todo
- (range-next p-range) (first-item (car p-range))))
-
- ((pair? todo)
- (iter rslt stng hzeps done (cdr todo) (prule-range (car todo)) '()))
-
- ((and hzeps (pair? stng))
- ;; Last pass saw an $epsilon so check the next input symbol,
- ;; with saweps reset to #f.
- (let* ((symb (car stng)) (stng1 (cdr stng)) (symbl (list symb)))
- (if (terminal? symb)
- (iter (cons symb rslt) stng1
- (and hzeps (memq symb eps-l))
- done todo p-range '())
- (iter rslt stng1
- (or (eq? symb '$epsilon) (memq symb eps-l))
- symbl symbl '() '()))))
- (hzeps
- ;; $epsilon passes all the way through.
- ;; If end-token-list provided use that.
- (if (pair? end-token-list)
- (lset-union eqv? rslt end-token-list)
- (cons '$epsilon rslt)))
- (else
- rslt)))))
-
-;; @deffn item->stng item => list-of-symbols
-;; Convert item (e.g., @code{(1 . 2)}) to list of symbols to the end of the
-;; production(?). If item is at the end of the rule then return
-;; @code{'$epsilon}. The term "stng" is used to avoid confusion about the
-;; term string.
-(define (item->stng item)
- (if (eqv? (cdr item) -1)
- (list '$epsilon)
- (let* ((core (fluid-ref *lalr-core*))
- (rhs-v (core-rhs-v core))
- (rhs (vector-ref rhs-v (car item))))
- (let iter ((res '()) (ix (1- (vector-length rhs))))
- (if (< ix (cdr item)) res
- (iter (cons (vector-ref rhs ix) res) (1- ix)))))))
-
-;; add (item . toks) to (front of) la-item-l
-;; i.e., la-item-l is unmodified
-(define (merge-la-item la-item-l item toks)
- (let* ((pair (assoc item la-item-l))
- (tokl (if (pair? pair) (cdr pair) '()))
- (allt ;; union of toks and la-item-l toks
- (let iter ((tl tokl) (ts toks))
- (if (null? ts) tl
- (iter (if (memq (car ts) tl) tl (cons (car ts) tl))
- (cdr ts))))))
- (if (not pair) (acons item allt la-item-l)
- (if (eqv? tokl allt) la-item-l
- (acons item allt la-item-l)))))
-
-;; @deffn first-following item toks => token-list
-;; For la-item A => x.By,z (where @code{item}, @code{toks}), this
-;; procedure computes @code{FIRST(yz)}.
-(define (first-following item toks)
- (first (item->stng (next-item item)) toks))
-
-;; @deffn closure la-item-l => la-item-l
-;; Compute the closure of a list of la-items.
-;; Ref: DB, Fig 4.38, Sec. 4.7, p. 232
-(define (closure la-item-l)
- ;; Compute the fixed point of I, aka @code{la-item-l}, with procedure
- ;; for each item [A => x.By, a] in I
- ;; each production B => z in G
- ;; and each terminal b in FIRST(ya)
- ;; such that [B => .z, b] is not in I do
- ;; add [B => .z, b] to I
- ;; The routine @code{fixed-point} operates on one element of the input set.
- (prune-assoc
- (fixed-point
- (lambda (la-item seed)
- (let* ((item (car la-item)) (toks (cdr la-item)) (symb (looking-at item)))
- (cond
- ((last-item? (car la-item)) seed)
- ((terminal? (looking-at (car la-item))) seed)
- (else
- (let iter ((seed seed) (pr (prule-range symb)))
- (cond
- ((null? pr) seed)
- (else
- (iter (merge-la-item seed (first-item (car pr))
- (first-following item toks))
- (range-next pr)))))))))
- la-item-l)))
-
-;; @deffn kit-add kit-v tokens sx item
-;; Add @code{tokens} to the list of lookaheads for the (kernel) @code{item}
-;; in state @code{sx}. This is a helper for @code{step2}.
-(define (kit-add kit-v tokens kx item)
- (let* ((al (vector-ref kit-v kx)) ; a-list for k-set kx
- (ar (assoc item al)) ; tokens for item
- (sd (if (pair? ar) ; set difference
- (lset-difference eqv? tokens (cdr ar))
- tokens)))
- (cond ; no entry, update entry, no update
- ((null? tokens) #f)
- ((not ar) (vector-set! kit-v kx (acons item tokens al)) #t)
- ((pair? sd) (set-cdr! ar (append sd (cdr ar))) #t)
- (else #f))))
-
-;; @deffn kip-add kip-v sx0 it0 sx1 it1
-;; This is a helper for step2. It updates kip-v with a propagation from
-;; state @code{sx0}, item @code{it0} to state @code{sx1}, item @code{it1}.
-;; [kip-v sx0] -> (it0 . ((sx1 . it1)
-(define (kip-add kip-v sx0 it0 sx1 it1)
- (let* ((al (vector-ref kip-v sx0)) (ar (assoc it0 al)))
- (cond
- ((not ar)
- (vector-set! kip-v sx0 (acons it0 (list (cons sx1 it1)) al)) #t)
- ((member it1 (cdr ar)) #f)
- (else
- (set-cdr! ar (acons sx1 it1 (cdr ar))) #t))))
-
-;; @deffn step2 p-mach-1 => p-mach-2
-;; This implements steps 2 and 3 of Algorithm 4.13 on p. 242 of the DB.
-;; The a-list @code{p-mach-1} includes the kernel itemsets and transitions
-;; from @code{step1}. This routine adds two entries to the a-list:
-;; the initial set of lookahead tokens in a vector associated with key
-;; @code{'kit-v} and a vector of spontaneous propagations associated with
-;; key @code{'kip-v}.
-;; @example
-;; for-each item I in some itemset
-;; for-each la-item J in closure(I,#)
-;; for-each token T in lookaheads(J)
-;; if LA is #, then add to J propagate-to list
-;; otherwise add T to spontaneously-generated list
-;; @end example
-(define (step2 p-mach)
- (let* ((kis-v (assq-ref p-mach 'kis-v))
- (kix-v (assq-ref p-mach 'kix-v)) ; transitions?
- (nkset (vector-length kis-v)) ; number of k-item-sets
- ;; kernel-itemset tokens
- (kit-v (make-vector nkset '())) ; sx => alist: (item latoks)
- ;; kernel-itemset propagations
- (kip-v (make-vector nkset '()))) ; sx0 => ((ita (sx1a . it1a) (sx2a
- (vector-set! kit-v 0 (closure (list (list '(0 . 0) '$end))))
- (let iter ((kx -1) (kset '()))
- (cond
- ((pair? kset)
- (for-each
- (lambda (la-item)
- (let* ((item (car la-item)) ; closure item
- (tokl (cdr la-item)) ; tokens
- (sym (looking-at item)) ; transition symbol
- (item1 (next-item item)) ; next item after sym
- (sx1 (assq-ref (vector-ref kix-v kx) sym)) ; goto(I,sym)
- (item0 (car kset))) ; kernel item
- (kit-add kit-v (delq '$@ tokl) sx1 item1) ; spontaneous
- (if (memq '$@ tokl) ; propagates
- (kip-add kip-v kx item0 sx1 item1))))
- (remove ;; todo: check this remove
- (lambda (li) (last-item? (car li)))
- (closure (list (cons (car kset) '($@))))))
- (iter kx (cdr kset)))
-
- ((< (1+ kx) nkset)
- (iter (1+ kx)
- ;; End-items don't shift, so don't propagate.
- (remove last-item? (vector-ref kis-v (1+ kx)))))))
- ;;(when #f (pp-kip-v kip-v) (pp-kit-v kit-v)) ; for debugging
- (cons* (cons 'kit-v kit-v) (cons 'kip-v kip-v) p-mach)))
-
-;; debug for step2
-(define (pp-kit ix kset)
- (fmtout "~S:\n" ix)
- (for-each
- (lambda (item) (fmtout " ~A, ~S\n" (pp-item (car item)) (cdr item)))
- kset))
-(define (pp-kit-v kit-v)
- (fmtout "spontaneous:\n")
- (vector-for-each pp-kit kit-v))
-(define (pp-kip ix kset)
- (for-each
- (lambda (x)
- (fmtout "~S: ~A\n" ix (pp-item (car x)))
- (for-each
- (lambda (y) (fmtout " => ~S: ~A\n" (car y) (pp-item (cdr y))))
- (cdr x)))
- kset))
-(define (pp-kip-v kip-v)
- (fmtout "propagate:\n")
- (vector-for-each pp-kip kip-v))
-
-;; @deffn step3 p-mach-2 => p-mach-3
-;; Execute nyacc step 3, where p-mach means ``partial machine''.
-;; This implements step 4 of Algorithm 4.13 from the DB.
-(define (step3 p-mach)
- (let* ((kit-v (assq-ref p-mach 'kit-v))
- (kip-v (assq-ref p-mach 'kip-v))
- (nkset (vector-length kit-v)))
- (let iter ((upd #t) ; token propagated?
- (kx -1) ; current index
- (ktal '()) ; (item . LA) list for kx
- (toks '()) ; LA tokens being propagated
- (item '()) ; from item
- (prop '())) ; to items
- (cond
- ((pair? prop)
- ;; Propagate lookaheads.
- (let* ((sx1 (caar prop)) (it1 (cdar prop)))
- (iter (or (kit-add kit-v toks sx1 it1) upd)
- kx ktal toks item (cdr prop))))
-
- ((pair? ktal)
- ;; Process the next (item . tokl) in the alist ktal.
- (iter upd kx (cdr ktal) (cdar ktal) (caar ktal)
- (assoc-ref (vector-ref kip-v kx) (caar ktal))))
-
- ((< (1+ kx) nkset)
- ;; Process the next itemset.
- (iter upd (1+ kx) (vector-ref kit-v (1+ kx)) '() '() '()))
-
- (upd
- ;; Have updates, rerun.
- (iter #f 0 '() '() '() '()))))
- p-mach))
-
-;; @deffn reductions kit-v sx => ((tokA gxA1 ...) (tokB gxB1 ...) ...)
-;; This is a helper for @code{step4}.
-;; Return an a-list of reductions for state @code{sx}.
-;; The a-list pairs are make of a token and a list of prule indicies.
-;; CHECK the following. We are brute-force using @code{closure} here.
-;; It works, but there should be a better algorithm.
-;; Note on reductions: We reduce if the kernel-item is an end-item or a
-;; non-kernel item with an epsilon-production. That is, if we have a
-;; kernel item of the form
-;; @example
-;; A => abc.
-;; @end example
-;; or if we have the non-kernel item of the form
-;; @example
-;; B => .de
-;; @end example
-;; where FIRST(de,#) includes #. See the second paragraph under ``Efficient
-;; Construction of LALR Parsing Tables'' in DB Sec 4.7.
-(define (old-reductions kit-v sx)
- (let iter ((ral '()) ; result: reduction a-list
- (lais (vector-ref kit-v sx)) ; la-item list
- (toks '()) ; kernel la-item LA tokens
- (itms '()) ; all items
- (gx #f) ; rule reduced by tl
- (tl '())) ; LA-token list
- (cond
- ((pair? tl) ;; add (token . p-rule) to reduction list
- (let* ((tk (car tl)) (rp (assq tk ral)))
- (cond
- ;; already have this, skip to next token
- ((and rp (memq gx (cdr rp)))
- (iter ral lais toks itms gx (cdr tl)))
- (rp
- ;; have token, add prule
- (set-cdr! rp (cons gx (cdr rp)))
- (iter ral lais toks itms gx (cdr tl)))
- (else
- ;; add token w/ prule
- (iter (cons (list tk gx) ral) lais toks itms gx (cdr tl))))))
-
- ((pair? itms)
- (if (last-item? (car itms))
- ;; last item, add it
- (iter ral lais toks (cdr itms) (caar itms) toks)
- ;; skip to next
- (iter ral lais toks (cdr itms) 0 '())))
-
- ((pair? lais) ;; process next la-item
- (iter ral (cdr lais) (cdar lais) (expand-k-item (caar lais)) 0 '()))
-
- (else ral))))
-;; I think the above is broken because I'm not including the proper tail
-;; string. The following just uses closure to do the job. It works but
-;; may not be very efficient: seems a bit brute force.
-(define (new-reductions kit-v sx)
- (let iter ((ral '()) ; result: reduction a-list
- (klais (vector-ref kit-v sx)) ; kernel la-item list
- (laits '()) ; all la-items
- (gx #f) ; rule reduced by tl
- (tl '())) ; LA-token list
- (cond
- ((pair? tl) ;; add (token . p-rule) to reduction list
- (let* ((tk (car tl)) (rp (assq tk ral)))
- (cond
- ((and rp (memq gx (cdr rp)))
- ;; already have this, skip to next token
- (iter ral klais laits gx (cdr tl)))
- (rp
- ;; have token, add prule
- (set-cdr! rp (cons gx (cdr rp)))
- (iter ral klais laits gx (cdr tl)))
- (else
- ;; add token w/ prule
- (iter (cons (list tk gx) ral) klais laits gx (cdr tl))))))
-
- ((pair? laits) ;; process a la-itemset
- (if (last-item? (caar laits))
- ;; last item, add it
- (iter ral klais (cdr laits) (caaar laits) (cdar laits))
- ;; else skip to next
- (iter ral klais (cdr laits) 0 '())))
-
- ((pair? klais) ;; expand next kernel la-item
- ;; There is a cheaper way than closure to do this but for now ...
- (iter ral (cdr klais) (closure (list (car klais))) 0 '()))
-
- (else
- ral))))
-(define reductions new-reductions)
-
-;; Generate parse-action-table from the shift a-list and reduce a-list.
-;; This is a helper for @code{step4}. It converts a list of state transitions
-;; and a list of reductions into a parse-action table of shift, reduce,
-;; accept, shift-reduce conflict or reduce-reduce conflict.
-;; The actions take the form:
-;; @example
-;; (shift . <dst-state>)
-;; (reduce . <rule-index>)
-;; (accept . 0)
-;; (srconf . (<dst-state> . <p-rule>))
-;; (rrconf . <list of p-rules indices>)
-;; @end example
-;; If a shift has multiple reduce conflicts we report only one reduction.
-(define (gen-pat sft-al red-al)
- (let iter ((res '()) (sal sft-al) (ral red-al))
- (cond
- ((pair? sal)
- (let* ((term (caar sal)) ; terminal
- (goto (cdar sal)) ; target state
- (redp (assq term ral)) ; a-list entry, may be removed
- ;;(redl (if redp (cdr redp) #f))) ; reductions on terminal
- (redl (and=> redp cdr))) ; reductions on terminal
- (cond
- ((and redl (pair? (cdr redl)))
- ;; This means we have a shift-reduce and reduce-reduce conflicts.
- ;; We record only one shift-reduce and keep the reduce-reduce.
- (iter (cons (cons* term 'srconf goto (car redl)) res)
- (cdr sal) ral))
- (redl
- ;; The terminal (aka token) signals a single reduction. This means
- ;; we have one shift-reduce conflict. We have a chance to repair
- ;; the parser using precedence/associativity rules so we remove the
- ;; reduction from the reduction-list.
- (iter (cons (cons* term 'srconf goto (car redl)) res)
- (cdr sal) (delete redp ral)))
- (else
- ;; The terminal (aka token) signals a shift only.
- (iter (cons (cons* term 'shift goto) res)
- (cdr sal) ral)))))
- ((pair? ral)
- (let ((term (caar ral)) (rest (cdar ral)))
- ;; We keep 'accept as explict action. Another option is to reduce and
- ;; have 0-th p-rule action generate return from parser (via prompt?).
- (iter
- (cons (cons term
- (cond ;; => action and arg(s)
- ((zero? (car rest)) (cons 'accept 0))
- ((zero? (car rest)) (cons 'reduce (car rest)))
- ((> (length rest) 1) (cons 'rrconf rest))
- (else (cons 'reduce (car rest)))))
- res) sal (cdr ral))))
- (else res))))
-
-
-;; @deffn step4 p-mach-0 => p-mach-1
-;; This generates the parse action table from the itemsets and then applies
-;; precedence and associativity rules to eliminate shift-reduce conflicts
-;; where possible. The output includes the parse action table (entry
-;; @code{'pat-v} and TBD (list of errors in @code{'err-l}).
-;;.per-state: alist by symbol:
-;; (symb <id>) if <id> > 0 SHIFT to <id>, else REDUCE by <id> else
-;; so ('$end . 0) means ACCEPT!
-;; but 0 for SHIFT and REDUCE, but reduce 0 is really ACCEPT
-;; if reduce by zero we are done. so never hit state zero accept on ACCEPT?
-;; For each state, the element of pat-v looks like
-;; ((tokenA . (reduce . 79)) (tokenB . (reduce . 91)) ... )
-(define (step4 p-mach)
-
- (define (setup-assc assc)
- (fold (lambda (al seed)
- (append (x-flip al) seed)) '() assc))
-
- (define (setup-prec prec)
- (let iter ((res '()) (rl '()) (hd '()) (pl '()) (pll prec))
- (cond
- ((pair? pl)
- (let* ((p (car pl)) (hdp (x-comb hd p))
- (pp (remove (lambda (p) (eqv? (car p) (cdr p))) (x-comb p p))))
- (iter res (append rl hdp pp) (car pl) (cdr pl) pll)))
- ((pair? rl) (iter (append res rl) '() hd pl pll))
- ((pair? pll) (iter res rl '() (car pll) (cdr pll)))
- (else res))))
-
- (define (prev-sym act its)
- (let* ((a act)
- (tok (car a)) (sft (caddr a)) (red (cdddr a))
- ;; @code{pit} is the end-item in the p-rule to be reduced.
- (pit (prev-item (prev-item (cons red -1))))
- ;; @code{psy} is the last symbol in the p-rule to be reduced.
- (psy (looking-at pit)))
- psy))
-
- (let* ((kis-v (assq-ref p-mach 'kis-v)) ; states
- (kit-v (assq-ref p-mach 'kit-v)) ; la-toks
- (kix-v (assq-ref p-mach 'kix-v)) ; transitions
- (assc (assq-ref p-mach 'assc)) ; associativity rules
- (assc (setup-assc assc)) ; trying it
- (prec (assq-ref p-mach 'prec)) ; precedence rules
- (prec (setup-prec prec)) ; trying it
- (nst (vector-length kis-v)) ; number of states
- (pat-v (make-vector nst '())) ; parse-act tab /state
- (rat-v (make-vector nst '())) ; removed-act tab /state
- (gen-pat-ix (lambda (ix) ; pat from shifts & reduc's
- (gen-pat (vector-ref kix-v ix) (reductions kit-v ix))))
- (prp-v (assq-ref p-mach 'prp-v)) ; per-rule precedence
- (tl (assq-ref p-mach 'terminals)) ; for error msgs
- )
- ;; We run through each itemset.
- ;; @enumerate
- ;; @item We have a-list of symbols to shift state (i.e., @code{kix-v}).
- ;; @item We generate a list of tokens to reduction from @code{kit-v}.
- ;; @end enumerate
- ;; Q: should '$end be edited out of shifts?
- ;; kit-v is vec of a-lists of form ((item tok1 tok2 ...) ...)
- ;; turn to (tok1 item1 item2 ...)
- (let iter ((ix 0) ; state index
- (pat '()) ; parse-action table
- (rat '()) ; removed-action table
- (wrn '()) ; warnings on unsolicited removals
- (ftl '()) ; fatal conflicts
- (actl (gen-pat-ix 0))) ; action list
- (cond
- ((pair? actl)
- (case (cadar actl)
- ((shift reduce accept)
- (iter ix (cons (car actl) pat) rat wrn ftl (cdr actl)))
- ((srconf)
- (let* ((act (car actl))
- (tok (car act)) (sft (caddr act)) (red (cdddr act))
- (prp (vector-ref prp-v red))
- (psy (prev-sym act (vector-ref kis-v ix)))
- (preced (or (and prp (prece prp tok prec)) ; rule-based
- (prece psy tok prec))) ; oper-based
- (sft-a (cons* tok 'shift sft))
- (red-a (cons* tok 'reduce red)))
- (call-with-values
- (lambda ()
- ;; Use precedence or, if =, associativity.
- (case preced
- ((#\>)
- (values red-a (cons sft-a 'pre) #f #f))
- ((#\<)
- (values sft-a (cons red-a 'pre) #f #f))
- ((#\=) ;; Now use associativity
- (case (assq-ref assc tok)
- ((left)
- (values red-a (cons sft-a 'ass) #f #f))
- ((right)
- (values sft-a (cons red-a 'ass) #f #f))
- ((nonassoc)
- (values (cons* tok 'error red) #f #f (cons ix act)))
- (else
- (values sft-a (cons red-a 'def) (cons ix act) #f))))
- (else ;; Or default, which is shift.
- (values sft-a (cons red-a 'def) (cons ix act) #f))))
- (lambda (a r w f)
- (iter ix
- (if a (cons a pat) pat)
- (if r (cons r rat) rat)
- (if w (cons w wrn) wrn)
- (if f (cons f ftl) ftl)
- (cdr actl))))))
- ((rrconf)
- #;(fmterr "*** reduce-reduce conflict: in state ~A on ~A: ~A\n"
- ix (obj->str (find-terminal (caar actl) tl)) (cddar actl))
- (iter ix (cons (car actl) pat) rat wrn
- (cons (cons ix (car actl)) ftl) (cdr actl)))
- (else
- (error "PROBLEM"))))
- ((null? actl)
- (vector-set! pat-v ix pat)
- (vector-set! rat-v ix rat)
- (iter ix pat rat wrn ftl #f))
- ((< (1+ ix) nst)
- (iter (1+ ix) '() '() wrn ftl (gen-pat-ix (1+ ix))))
- (else
- (let* ((attr (assq-ref p-mach 'attr))
- (expect (assq-ref attr 'expect))) ; expected # srconf
- (if (not (= (length wrn) expect))
- (for-each (lambda (m) (fmterr "+++ warning: ~A\n" (conf->str m)))
- (reverse wrn)))
- (for-each
- (lambda (m) (fmterr "*** fatal: ~A\n" (conf->str m)))
- (reverse ftl))
- ))))
- ;; Return mach with parse-action and removed-action tables.
- (cons* (cons 'pat-v pat-v) (cons 'rat-v rat-v) p-mach)))
-
-;; @deffn conf->str cfl => string
-;; map conflict (e.g., @code{('rrconf 1 . 2}) to string.
-(define (conf->str cfl)
- (let* ((st (list-ref cfl 0)) (tok (list-ref cfl 1)) (typ (list-ref cfl 2))
- (core (fluid-ref *lalr-core*)) (terms (core-terminals core)))
- (fmtstr "in state ~A, ~A conflict on ~A"
- st
- (case typ
- ((srconf) "shift-reduce")
- ((rrconf) "reduce-reduce")
- (else "unknown"))
- (obj->str (find-terminal tok terms)))))
-
-;; @deffn gen-match-table mach => mach
-;; Generate the match-table for a machine. The match table is a list of
-;; pairs: the car is the token used in the grammar specification, the cdr
-;; is the symbol that should be returned by the lexical analyzer.
-;;
-;; The match-table may be passed to
-;; the lexical analyzer builder to identify strings or string-types as tokens.
-;; The associated key in the machine is @code{mtab}.
-;; @enumerate
-;; @item
-;; @sc{nyacc}-reserved symbols are provided as symbols
-;; @example
-;; $ident -> ($ident . $ident)
-;; @end example
-;; @item
-;; Terminals used as symbols (@code{'comment} versus @code{"comment"}) are
-;; provided as symbols. The spec parser will provide a warning if symbols
-;; are used in both ways.
-;; @item
-;; Others are provided as strings.
-;; @end enumerate
-;; The procedure @code{hashify-machine} will convert the cdrs to integers.
-;; Test: "$abc" => ("$abc" '$abc) '$abc => ('$abc . '$abc)
-(define (gen-match-table mach)
- (cons
- (cons 'mtab (map (lambda (term) (cons term (atomize term)))
- (assq-ref mach 'terminals)))
- mach))
-
-
-;; @deffn add-recovery-logic! mach => mach
-;; Target of transition from @code{'$error} should have a default rule that
-;; loops back.
-(define (add-recovery-logic-1 mach)
- (let* ((kis-v (assq-ref mach 'kis-v))
- (rhs-v (assq-ref mach 'rhs-v))
- (pat-v (assq-ref mach 'pat-v))
- (n (vector-length pat-v))
- )
- (vector-for-each
- (lambda (kx kis)
- ;;(fmtout "kis=~S\n " kis)
- (for-each
- (lambda (ki)
- (let* ((pi (prev-item ki))
- (rhs (vector-ref rhs-v (car pi))))
- (when (and (not (negative? (cdr pi)))
- (eqv? '$error (looking-at pi)))
- (vector-set! pat-v kx
- (append
- (vector-ref pat-v kx)
- `(($default shift . ,kx))))
- #;(fmtout " => ~S\n" (vector-ref pat-v kx)))))
- kis)
- ;;(fmtout "\n")
- #f)
- kis-v)
- mach))
-
-(define (add-recovery-logic! mach)
- (let ((prev-core (fluid-ref *lalr-core*)))
- (dynamic-wind
- (lambda () (fluid-set! *lalr-core* (make-core/extras mach)))
- (lambda () (add-recovery-logic-1 mach))
- (lambda () (fluid-set! *lalr-core* prev-core)))))
-
-;; to build parser, need:
-;; pat-v - parse action table
-;; ref-v - references
-;; len-v - rule lengths
-;; rto-v - hashed lhs symbols (rto = reduce to)
-;; to print itemsets need:
-;; lhs-v - left hand sides
-;; rhs-v - right hand sides
-;; kis-v - itemsets
-;; pat-v - action table
-
-;; @deffn restart-spec [spec|mach] start => spec
-;; This generates a new spec with a different start.
-;; @example
-;; (restart-spec clang-spec 'expression) => cexpr-spec
-;; @end example
-(define (restart-spec spec start)
- (let* ((rhs-v (vector-copy (assq-ref spec 'rhs-v))))
- (vector-set! rhs-v 0 (vector start))
- (cons* (cons 'rhs-v rhs-v)
- (member '(restart-tail . #t) spec))))
-
-;; @deffn make-lalr-machine spec => pgen
-;; Generate a-list of items used for building/debugging parsers.
-;; It might be useful to add hashify and compact with keyword arguments.
-(define (make-lalr-machine spec)
- (if (not spec) (error "make-lalr-machine: expecting valid specification"))
- (let ((prev-core (fluid-ref *lalr-core*)))
- (dynamic-wind
- (lambda () (fluid-set! *lalr-core* (make-core/extras spec)))
- (lambda ()
- (let* ((sm1 (step1 spec))
- (sm2 (step2 sm1))
- (sm3 (step3 sm2))
- (sm4 (step4 sm3))
- (sm5 (gen-match-table sm4)))
- (cons*
- (cons 'len-v (vector-map (lambda (i v) (vector-length v))
- (assq-ref sm5 'rhs-v)))
- (cons 'rto-v (vector-copy (assq-ref sm5 'lhs-v))) ; "reduce to"
- sm5)))
- (lambda () (fluid-set! *lalr-core* prev-core)))))
-
-;; for debugging
-(define (make-LR0-machine spec)
- (if (not spec) (error "make-LR0-machine: expecting valid specification"))
- (let ((prev-core (fluid-ref *lalr-core*)))
- (dynamic-wind
- (lambda () (fluid-set! *lalr-core* (make-core/extras spec)))
- (lambda () (step1 spec))
- (lambda () (fluid-set! *lalr-core* prev-core)))))
-
-;; @deffn with-spec spec proc arg ...
-;; Execute with spec or mach.
-(define (with-spec spec proc . args)
- (if (not spec) (error "with-spec: expecting valid specification"))
- (let ((prev-core (fluid-ref *lalr-core*)))
- (dynamic-wind
- (lambda () (fluid-set! *lalr-core* (make-core/extras spec)))
- (lambda () (apply proc args))
- (lambda () (fluid-set! *lalr-core* prev-core)))))
-
-;; @deffn lalr-match-table mach => match-table
-;; Get the match-table
-(define (lalr-match-table mach)
- (assq-ref mach 'mtab))
-
-;; @deffn machine-compacted? mach => #t|#f
-;; Indicate if the machine has been compacted.
-;; TODO: needs update to deal with error recovery hooks.
-(define (machine-compacted? mach)
- ;; Works by searching for $default phony-token.
- (call-with-prompt 'got-it
- ;; Search for '$default. If not found return #f.
- (lambda ()
- (vector-for-each
- (lambda (ix pat)
- (for-each
- (lambda (a) (if (or (eqv? (car a) '$default) (eqv? (car a) -1))
- (abort-to-prompt 'got-it)))
- pat))
- (assq-ref mach 'pat-v))
- #f)
- ;; otherwise, return #t.
- (lambda () #t)))
-
-;; The list of tokens that do not get absorbed into default reductions.
-;; See @code{compact-machine} below.
-(define default-keepers '($error $lone-comm $code-comm $end))
-
-;; @deffn compact-machine mach [#:keep 3] [#:keepers '()] => mach
-;; A "filter" to compact the parse table. For each state this will replace
-;; the most populus set of reductions of the same production rule with a
-;; default production. However, reductions triggered by user-specified keepers
-;; and the default keepers -- @code{'$error}, @code{'$end}, @code{'$lone-comm}
-;; and @code{'$lone-comm} are not counted. The parser will want to treat
-;; errors and comments separately so that they can be trapped (e.g.,
-;; unaccounted comments are skipped).
-;; @end deffn
-(define* (compact-machine mach #:key (keep 3) (keepers '()))
- (let* ((pat-v (assq-ref mach 'pat-v))
- (nst (vector-length pat-v))
- (hashed (number? (caar (vector-ref pat-v 0)))) ; been hashified?
- (reduce? (if hashed
- (lambda (a) (and (number? a) (negative? a)))
- (lambda (a) (eq? 'reduce (car a)))))
- (reduce-pr (if hashed abs cdr))
- (reduce-to? (if hashed
- (lambda (a r) (eqv? (- r) a))
- (lambda (a r) (and (eq? 'reduce (car a))
- (eqv? r (cdr a))))))
- (mk-default (if hashed
- (lambda (r) (cons -1 (- r)))
- (lambda (r) `($default reduce . ,r))))
- (mtab (assq-ref mach 'mtab))
- (keepers (map (lambda (k) (assq-ref mtab k))
- (append keepers default-keepers))))
-
- ;; Keep an a-list mapping reduction prod-rule => count.
- (let iter ((sx nst) (trn-l #f) (cnt-al '()) (p-max '(0 . 0)))
- (cond
- ((pair? trn-l)
- (cond
- ((not (reduce? (cdar trn-l)))
- ;; A shift, so not a candidate for default reduction.
- (iter sx (cdr trn-l) cnt-al p-max))
- ((memq (caar trn-l) keepers)
- ;; Don't consider keepers because these will not be included.
- (iter sx (cdr trn-l) cnt-al p-max))
- (else
- ;; A reduction, so update the count for reducing this prod-rule.
- (let* ((ix (reduce-pr (cdar trn-l)))
- (cnt (1+ (or (assq-ref cnt-al ix) 0)))
- (cnt-p (cons ix cnt)))
- (iter sx (cdr trn-l) (cons cnt-p cnt-al)
- (if (> cnt (cdr p-max)) cnt-p p-max))))))
-
- ((null? trn-l)
- ;; We have processed all transitions. If more than @code{keep} common
- ;; reductions then generate default rule to replace those.
- (if (> (cdr p-max) keep)
- (vector-set!
- pat-v sx
- (fold-right
- (lambda (trn pat) ;; transition action
- ;; If not a comment and reduces to the most-popular prod-rule
- ;; then transfer to the default transition.
- (if (and (not (memq (car trn) keepers))
- (reduce-to? (cdr trn) (car p-max)))
- pat
- (cons trn pat)))
- (list (mk-default (car p-max))) ;; default is last
- (vector-ref pat-v sx))))
- (iter sx #f #f #f))
- ((positive? sx) ;; next state
- (iter (1- sx) (vector-ref pat-v (1- sx)) '() '(0 . 0)))))
- mach))
-
-;;.@section Using hash tables
-;; The lexical analyzer will generate tokens. The parser generates state
-;; transitions based on these tokens. When we build a lexical analyzer
-;; (via @code{make-lexer}) we provide a list of strings to detect along with
-;; associated tokens to return to the parser. By default the tokens returned
-;; are symbols or characters. But these could as well be integers. Also,
-;; the parser uses symbols to represent non-terminals, which are also used
-;; to trigger state transitions. We could use integers instead of symbols
-;; and characters by mapping via a hash table. We will bla bla bla.
-;; There are also standard tokens we need to worry about. These are
-;; @enumerate
-;; @item the @code{$end} marker
-;; @item identifiers (using the symbolic token @code{$ident}
-;; @item non-negative integers (using the symbolic token @code{$fixed})
-;; @item non-negative floats (using the symbolic token @code{$float})
-;; @item @code{$default} => 0
-;; @end enumerate
-;; And action
-;; @enumerate
-;; @item positive => shift
-;; @item negative => reduce
-;; @item zero => accept
-;; @end enumerate
-;; However, if these are used they should appear in the spec's terminal list.
-;; For the hash table we use positive integers for terminals and negative
-;; integers for non-terminals. To apply such a hash table we need to:
-;; @enumerate
-;; @item from the spec's list of terminals (aka tokens), generate a list of
-;; terminal to integer pairs (and vice versa)
-;; @item from the spec's list of non-terminals generate a list of symbols
-;; to integers and vice versa.
-;; @item Go through the parser-action table and convert symbols and characters
-;; to integers
-;; @item Go through the XXX list passed to the lexical analyizer and replace
-;; symbols and characters with integers.
-;; @end enumerate
-;; One issue we need to deal with is separating out the identifier-like
-;; terminals (aka keywords) from those that are not identifier-like. I guess
-;; this should be done as part of @code{make-lexer}, by filtering the token
-;; list through the ident-reader.
-;; NOTE: The parser is hardcoded to assume that the phony token for the
-;; default (reduce) action is @code{'$default} for unhashed machine or
-;; @code{-1} for a hashed machine.
-
-;; NEW: need to add reduction of ERROR
-
-;; @deffn machine-hashed? mach => #t|#f
-;; Indicate if the machine has been hashed.
-(define (machine-hashed? mach)
- ;; If hashed, the parse action for rule 0 will always be a number.
- (number? (caar (vector-ref (assq-ref mach 'pat-v) 0))))
-
-;; @deffn hashify-machine mach => mach
-(define (hashify-machine mach)
- (if (machine-hashed? mach) mach
- (let* ((terminals (assq-ref mach 'terminals))
- (non-terms (assq-ref mach 'non-terms))
- (lhs-v (assq-ref mach 'lhs-v))
- (sm ;; = (cons sym->int int->sym)
- (let iter ((si (list (cons '$default -1)))
- (is (list (cons -1 '$default)))
- (ix 1) (tl terminals) (nl non-terms))
- (if (null? nl) (cons (reverse si) (reverse is))
- (let* ((s (atomize (if (pair? tl) (car tl) (car nl))))
- (tl1 (if (pair? tl) (cdr tl) tl))
- (nl1 (if (pair? tl) nl (cdr nl))))
- (iter (acons s ix si) (acons ix s is) (1+ ix) tl1 nl1)))))
- (sym->int (lambda (s) (assq-ref (car sm) s)))
- ;;
- (pat-v0 (assq-ref mach 'pat-v))
- (npat (vector-length pat-v0))
- (pat-v1 (make-vector npat '())))
- ;; replace symbol/chars with integers
- (let iter1 ((ix 0))
- (unless (= ix npat)
- (let iter2 ((al1 '()) (al0 (vector-ref pat-v0 ix)))
- (if (null? al0) (vector-set! pat-v1 ix (reverse al1))
- (let* ((a0 (car al0))
- ;; tk: token; ac: action; ds: destination
- (tk (car a0)) (ac (cadr a0)) (ds (cddr a0))
- ;; t: encoded token; d: encoded destination
- (t (sym->int tk))
- (d (case ac
- ((shift) ds) ((reduce) (- ds))
- ((accept) 0) (else #f))))
- (unless t
- (fmterr "~S ~S ~S\n" tk ac ds)
- (error "expect something"))
- (iter2 (acons t d al1) (cdr al0)))))
- (iter1 (1+ ix))))
- ;;
- (cons*
- (cons 'pat-v pat-v1)
- (cons 'siis sm) ;; sm = (cons sym->int int->sym)
- (cons 'mtab
- (let iter ((mt1 '()) (mt0 (assq-ref mach 'mtab)))
- (if (null? mt0) (reverse mt1)
- (iter (cons (cons (caar mt0) (sym->int (cdar mt0))) mt1)
- (cdr mt0)))))
- ;; reduction symbols = lhs:
- (cons 'rto-v (vector-map (lambda (i v) (sym->int v)) lhs-v))
- mach))))
-
-;; === grammar/machine printing ======
-
-;; @deffn elt->str elt terms => string
-(define (elt->str elt terms)
- (or (and=> (find-terminal elt terms) obj->str)
- (symbol->string elt)))
-
-;; @deffn pp-rule indent gx [port]
-;; Pretty-print a production rule.
-(define (pp-rule il gx . rest)
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (core (fluid-ref *lalr-core*))
- (lhs (vector-ref (core-lhs-v core) gx))
- (rhs (vector-ref (core-rhs-v core) gx))
- (tl (core-terminals core)))
- (display (substring " " 0 (min il 20)) port)
- (fmt port "~A =>" lhs)
- (vector-for-each (lambda (ix e) (fmt port " ~A" (elt->str e tl))) rhs)
- (newline port)))
-
-;; @deffn pp-item item => string
-;; This could be called item->string.
-;; This needs terminals to work correctly, like pp-lalr-grammar.
-(define (pp-item item)
- (let* ((core (fluid-ref *lalr-core*))
- (tl (core-terminals core))
- (gx (car item))
- (lhs (vector-ref (core-lhs-v core) gx))
- (rhs (vector-ref (core-rhs-v core) gx))
- (rhs-len (vector-length rhs)))
- (apply
- string-append
- (let iter ((rx 0) (sl (list (fmtstr "~S =>" lhs))))
- (if (= rx rhs-len)
- (append sl (if (= -1 (cdr item)) '(" .") '()))
- (iter (1+ rx)
- (append
- sl (if (= rx (cdr item)) '(" .") '())
- (let ((e (vector-ref rhs rx)))
- (list (string-append " " (elt->str e tl)))))))))))
-
-;; @deffn pp-lalr-notice spec [port]
-(define (pp-lalr-notice spec . rest)
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (notice (assq-ref (assq-ref spec 'attr) 'notice))
- (lines (if notice (string-split notice #\newline) '())))
- (for-each (lambda (l) (simple-format port " ~A\n" l)) lines)
- (newline)))
-
-;; @deffn pp-lalr-grammar spec [port]
-;; Pretty-print the grammar to the specified port, or current output.
-(define (pp-lalr-grammar spec . rest)
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (lhs-v (assq-ref spec 'lhs-v))
- (rhs-v (assq-ref spec 'rhs-v))
- (nrule (vector-length lhs-v))
- (act-v (assq-ref spec 'act-v))
- ;;(prp-v (assq-ref mach 'prp-v)) ; per-rule precedence
- (terms (assq-ref spec 'terminals))
- (prev-core (fluid-ref *lalr-core*)))
- (fluid-set! *lalr-core* (make-core spec)) ; OR dynamic-wind ???
- ;; Print out the grammar.
- (do ((i 0 (1+ i))) ((= i nrule))
- (let* ((lhs (vector-ref lhs-v i)) (rhs (vector-ref rhs-v i)))
- (if #f
- (pp-rule 0 i)
- (begin
- (fmt port "~A ~A =>" i lhs)
- (vector-for-each
- (lambda (ix e) (fmt port " ~A" (elt->str e terms)))
- rhs)
- ;;(fmt port "\t~S" (vector-ref act-v i))
- (newline port)))))
- (newline port)
- (fluid-set! *lalr-core* prev-core)))
-
-;; @deffn pp-lalr-machine mach [port]
-;; Print the states of the parser with items and shift/reduce actions.
-(define (pp-lalr-machine mach . rest)
- (let* ((port (if (pair? rest) (car rest) (current-output-port)))
- (lhs-v (assq-ref mach 'lhs-v))
- (rhs-v (assq-ref mach 'rhs-v))
- (nrule (vector-length lhs-v))
- (pat-v (assq-ref mach 'pat-v))
- (rat-v (assq-ref mach 'rat-v))
- (kis-v (assq-ref mach 'kis-v))
- (kit-v (assq-ref mach 'kit-v))
- (nst (vector-length kis-v)) ; number of states
- (i->s (or (and=> (assq-ref mach 'siis) cdr) '()))
- (terms (assq-ref mach 'terminals))
- (prev-core (fluid-ref *lalr-core*)))
- (fluid-set! *lalr-core* (make-core mach))
- ;; Print out the itemsets and shift reduce actions.
- (do ((i 0 (1+ i))) ((= i nst))
- (let* ((state (vector-ref kis-v i))
- (pat (vector-ref pat-v i))
- (rat (if rat-v (vector-ref rat-v i) '())))
- (fmt port "~A:" i) ; itemset index (aka state index)
- (for-each
- (lambda (k-item)
- (for-each ; item, print it
- (lambda (item)
- (fmt port "\t~A" (pp-item item))
- ;; show lookaheads:
- (if (and #f (negative? (cdr item)) kit-v (equal? item k-item))
- (fmt port " ~A"
- (map (lambda (tok) (elt->str tok terms))
- (assoc-ref (vector-ref kit-v i) k-item))))
- (fmt port "\n"))
- (expand-k-item k-item)))
- state)
- (for-each ; action, print it
- (lambda (act)
- (if (pair? (cdr act))
- (let ((sy (car act)) (pa (cadr act)) (gt (cddr act)))
- (case pa
- ((srconf)
- (fmt port "\t\t~A => CONFLICT: shift ~A, reduce ~A\n"
- (elt->str sy terms) (car gt) (cdr gt)))
- ((rrconf)
- (fmt port "\t\t~A => CONFLICT: reduce ~A\n"
- (elt->str sy terms)
- (string-join (map number->string gt) ", reduce ")))
- (else
- (fmt port "\t\t~A => ~A ~A\n" (elt->str sy terms) pa gt))))
- (let* ((sy (car act)) (p (cdr act))
- (pa (cond ((eq? #f p) 'CONFLICT)
- ((positive? p) 'shift)
- ((negative? p) 'reduce)
- (else 'accept)))
- (gt (and=> p abs)))
- (fmt port "\t\t~A => ~A ~A\n"
- (elt->str (assq-ref i->s sy) terms)
- pa gt))))
- pat)
- (for-each ; action, print it
- (lambda (ra)
- ;; FIX: should indicate if precedence removed user rule or default
- (fmt port "\t\t[~A => ~A ~A] REMOVED by ~A\n"
- (elt->str (caar ra) terms) (cadar ra) (cddar ra)
- (case (cdr ra)
- ((pre) "precedence")
- ((ass) "associativity")
- ((def) "default shift")
- (else (cdr ra)))))
- rat)
- (newline)))
- (fluid-set! *lalr-core* prev-core)
- (values)))
-
-;; === output routines ===============
-
-(use-modules (ice-9 pretty-print))
-(use-modules (ice-9 regex))
-
-(define (write-notice mach port)
- (let* ((comm-leader ";; ")
- (notice (assq-ref (assq-ref mach 'attr) 'notice))
- (lines (if notice (string-split notice #\newline) '())))
- (for-each
- (lambda (l) (fmt port "~A~A\n" comm-leader l))
- lines)
- (if (pair? lines) (newline port))))
-
-(define (string-sub str pat repl)
- (let ((m (string-match pat str)))
- (if m
- (regexp-substitute #f m 'pre repl 'post)
- str)))
-
-;; @deffn {Procedure} write-lalr-tables mach filename [optons]
-;; Options are
-;; @table code
-;; @item #:prefix prefix-string
-;; The prefix for generating table names. The default is @code{""}.
-;; @item #:lang output-lang-symbol
-;; This specifies the output language. Currently only the default
-;; @code{'scheme} is supported.
-;; @end table
-;; @noindent
-;; For example,
-;; @example
-;; write-lalr-tables mach "tables.scm"
-;; write-lalr-tables mach "tables.tcl" #:lang 'tcl
-;; @end example
-;; @end deffn
-(define* (write-lalr-tables mach filename #:key (lang 'scheme) (prefix ""))
-
- (define (write-table mach name port)
- (fmt port "(define ~A~A\n " prefix name)
- (ugly-print (assq-ref mach name) port)
- (fmt port ")\n\n"))
-
- (call-with-output-file filename
- (lambda (port)
- (fmt port ";; ~A\n\n" (string-sub filename ".new$" ""))
- (write-notice mach port)
- (write-table mach 'len-v port)
- (write-table mach 'pat-v port)
- (write-table mach 'rto-v port)
- (write-table mach 'mtab port)
- (display ";;; end tables" port)
- (newline port))))
-
-
-;; @deffn {Procedure} write-lalr-actions mach filename [#:lang output-lang]
-;; For example,
-;; @example
-;; write-lalr-actions mach "actions.scm"
-;; write-lalr-actions mach "actions.tcl" #:lang 'tcl
-;; @end example
-;; @end deffn
-(define* (write-lalr-actions mach filename #:key (lang 'scheme) (prefix ""))
-
- (define (pp-rule/ts gx)
- (let* ((core (fluid-ref *lalr-core*))
- (lhs (vector-ref (core-lhs-v core) gx))
- (rhs (vector-ref (core-rhs-v core) gx))
- (tl (core-terminals core))
- (line (string-append
- (symbol->string lhs) " => "
- (string-join
- (map (lambda (elt) (elt->str elt tl))
- (vector->list rhs))
- " "))))
- (if (> (string-length line) 72)
- (string-append (substring/shared line 0 69) "...")
- line)))
- (define (NEW-pp-rule/ts gx)
- ;; TBD: use start for zeroth rule
- (let* ((core (fluid-ref *lalr-core*))
- (lhs (vector-ref (core-lhs-v core) gx))
- (rhs (vector-ref (core-rhs-v core) gx))
- (tl (core-terminals core))
- (line (string-append
- (symbol->string lhs) " => "
- (string-join
- (map (lambda (elt) (elt->str elt tl))
- (vector->list rhs))
- " "))))
- (if (> (string-length line) 72)
- (string-append (substring/shared line 0 69) "...")
- line)))
-
- (define (write-actions mach port)
- (with-fluid*
- *lalr-core* (make-core mach)
- (lambda ()
- (fmt port "(define ~Aact-v\n (vector\n" prefix)
- (vector-for-each
- (lambda (gx actn)
- (fmt port " ;; ~A\n" (pp-rule/ts gx))
- (pretty-print (wrap-action actn) port #:per-line-prefix " "))
- (assq-ref mach 'act-v))
- (fmt port " ))\n\n"))))
-
- (call-with-output-file filename
- (lambda (port)
- (fmt port ";; ~A\n\n" (string-sub filename ".new$" ""))
- (write-notice mach port)
- (write-actions mach port)
- (display ";;; end tables" port)
- (newline port))))
-
-;; @end itemize
-;;; --- last line ---
+++ /dev/null
-(add-to-load-path "/Users/mwette/repo/sv/nyacc-master/module")
-;;; system/base/lalr2.scm
-;;;
-;;; Copyright (C) 2014-2017 Matthew R. Wette
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public License
-;;; along with this library; if not, see <http://www.gnu.org/licenses/>
-
-;; I need to find way to preserve srconf, rrconf after hashify.
-;; compact needs to deal with it ...
-
-;;(define-module (system base lalr2)
-(define-module (nyacc lalr2)
- #:export-syntax (lalr2-spec)
- #:export (*lalr2-version*
- )
- #:use-module ((srfi srfi-1) #:select (fold fold-right remove lset-union
- lset-intersection lset-difference))
- #:use-module ((srfi srfi-9) #:select (define-record-type))
- #:use-module ((srfi srfi-43) #:select (vector-map vector-for-each vector-any))
- #:use-module (nyacc util) ;; fmt fmtstr
- )
-(use-modules (ice-9 pretty-print))
-
-(define *lalr2-version* "0.01.0")
-
-(define (fmtstr fmt . args)
- (apply simple-format #f fmt args))
-(define (fmterr fmt . args)
- (apply simple-format #t fmt args))
-(define (fmtout fmt . args)
- (apply simple-format #t fmt args))
-(define fmt simple-format)
-
-;; @deffn reserved? grammar-symbol
-;; Determine whether the syntax argument is a reserved symbol, that is.
-;; So instead of writing @code{'$fixed} for syntax one can write
-;; @code{$fixed}. We may want to change this to
-;; @example
-;; (reserved-terminal? grammar-symbol)
-;; (reserved-non-term? grammar-symbol)
-;; @end example
-(define (reserved? grammar-symbol)
- ;; If the first character `$' then it's reserved.
- (eqv? #\$ (string-ref (symbol->string (syntax->datum grammar-symbol)) 0)))
-
-;; @deffn {Syntax} lalr2-spec grammar => spec
-;; This routine reads a grammar in a scheme-like syntax and returns an a-list.
-;; @end deffn
-(define-syntax lalr2-spec
- (syntax-rules +++ ()
- ((_ <expr> +++)
- (letrec-syntax
- ((parse-rhs
- (lambda (x)
- ;; The following is syntax-case because we use a fender.
- (syntax-case x (quote $$ $prec $empty)
- ;; action specifications
- ((_ ($$ <guts> ...) <e2> ...)
- #'(cons '(action #f <guts> ...) (parse-rhs <e2> ...)))
- ;; other internal $-syntax
- ((_ ($prec <tok>) <e2> ...)
- #'(cons (cons 'prec (tokenize <tok>)) (parse-rhs <e2> ...)))
- ((_ $empty <e2> ...) ; TODO: propagate to processor
- #'(cons '(empty) (parse-rhs <e2> ...)))
- ;; terminals and non-terminals
- ((_ (quote <e1>) <e2> ...)
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...)))
- ((_ (<f> ...) <e2> ...)
- #'(cons (<f> ...) (parse-rhs <e2> ...)))
- ((_ <e1> <e2> ...)
- (identifier? (syntax <e1>)) ; fender to trap non-terminals
- (if (reserved? (syntax <e1>))
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...))
- #'(cons '(non-terminal . <e1>) (parse-rhs <e2> ...))))
- ((_ <e1> <e2> ...)
- #'(cons '(terminal . <e1>) (parse-rhs <e2> ...)))
- ((_) #'(list)))))
- (parse-rhs-list
- (syntax-rules ()
- ((_ (<ex> ...) <rhs> ...)
- (cons (parse-rhs <ex> ...) (parse-rhs-list <rhs> ...)))
- ((_) '())))
- (parse-grammar
- (syntax-rules ()
- ((_ (<lhs> <rhs> ...) <prod> ...)
- (cons (cons '<lhs> (parse-rhs-list <rhs> ...))
- (parse-grammar <prod> ...)))
- ((_) '())))
- (tokenize
- (lambda (x)
- (syntax-case x ()
- ((_ <tk>) (identifier? (syntax <tk>)) #'(quote <tk>))
- ((_ <tk>) #'<tk>))))
- (tokenize-list
- (syntax-rules ()
- ((_ <tk1> <tk2> ...)
- (cons (tokenize <tk1>) (tokenize-list <tk2> ...)))
- ((_) '())))
- (parse-precedence
- (syntax-rules (left right nonassoc)
- ((_ (left <tk> ...) <ex> ...)
- (cons (cons 'left (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ (right <tk> ...) <ex> ...)
- (cons (cons 'right (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ (nonassoc <tk> ...) <ex> ...)
- (cons (cons 'nonassoc (tokenize-list <tk> ...))
- (parse-precedence <ex> ...)))
- ((_ <tk> <ex> ...)
- (cons (list 'undecl (tokenize <tk>))
- (parse-precedence <ex> ...)))
- ((_) '())))
- (lalr-spec-1
- (syntax-rules (start expect notice prec< prec> grammar)
- ((_ (start <symb>) <e> ...)
- (cons (cons 'start '<symb>) (lalr-spec-1 <e> ...)))
- ((_ (expect <n>) <e> ...)
- (cons (cons 'expect <n>) (lalr-spec-1 <e> ...)))
- ((_ (notice <str>) <e> ...)
- (cons (cons 'notice <str>) (lalr-spec-1 <e> ...)))
- ((_ (prec< <ex> ...) <e> ...)
- (cons (cons 'precedence (parse-precedence <ex> ...))
- (lalr-spec-1 <e> ...)))
- ((_ (prec> <ex> ...) <e> ...)
- (cons (cons 'precedence (reverse (parse-precedence <ex> ...)))
- (lalr-spec-1 <e> ...)))
- ((_ (grammar <prod> ...) <e> ...)
- (cons (cons 'grammar (parse-grammar <prod> ...))
- (lalr-spec-1 <e> ...)))
- ((_) '()))))
- (identity (lalr-spec-1 <expr> +++))))))
-
-;; @deffn atomize terminal => object
-;; Generate an atomic object for a terminal. Expected terminals are strings,
-;; characters and symbols. This will convert the strings @code{s} to symbols
-;; of the form @code{'$:s}.
-(define (atomize terminal)
- (if (string? terminal)
- (string->symbol (string-append "$:" terminal))
- terminal))
-
-(define (process-spec tree)
-
- ;; Make a new symbol. This is a helper for proxies and mid-rule-actions.
- ;; The counter here is the only @code{set!} in @code{process-spec}.
- ;; Otherwise, I believe @code{process-spec} is referentially transparent.
- (define maksy
- (let ((cntr 1))
- (lambda ()
- (let ((c cntr))
- (set! cntr (1+ cntr))
- (string->symbol (string-append "$P" (number->string c)))))))
-
- ;; Canonicalize precedence and associativity. Precedence will appear
- ;; as sets of equivalent items in increasing order of precedence
- ;; (e.g., @code{((+ -) (* /)}). The input tree has nodes that look like
- ;; @example
- ;; '(precedence (left "+" "-") (left "*" "/"))
- ;; '(precedence ('then "else")
- ;; @end example
- ;; @noindent
- ;; =>
- ;; @example
- ;; (prec ((+ -) (* /)) ((then) (else)))
- ;; @end example
- (define (prec-n-assc tree)
- ;; prec-l; lt-assc-l rt-assc-l non-assc-l pspec
- (let iter ((pll '()) (pl '()) (la '()) (ra '()) (na '())
- (spec '()) (tree tree))
- (cond
- ((pair? spec)
- ;; item ~ ('left "+" "-") => a ~ 'left, tl ~ (#\+ #\-)
- (let* ((item (car spec)) (as (car item)) (tl (map atomize (cdr item))))
- (case as
- ((left)
- (iter pll (cons tl pl) (append tl la) ra na (cdr spec) tree))
- ((right)
- (iter pll (cons tl pl) la (append tl ra) na (cdr spec) tree))
- ((nonassoc)
- (iter pll (cons tl pl) la ra (append tl na) (cdr spec) tree))
- ((undecl)
- (iter pll (cons tl pl) la ra na (cdr spec) tree)))))
- ((pair? pl)
- (iter (cons (reverse pl) pll) '() la ra na spec tree))
- ((pair? tree)
- (iter pll pl la ra na
- (if (eqv? 'precedence (caar tree)) (cdar tree) '()) (cdr tree)))
- (else
- (list
- `(prec . ,(reverse pll))
- `(assc (left ,@la) (right ,@ra) (nonassoc ,@na)))))))
-
- (let* ((gram (assq-ref tree 'grammar))
- (start-symbol (and=> (assq-ref tree 'start) atomize))
- (start-rule (lambda () (list start-symbol)))
- (add-el (lambda (e l) (if (member e l) l (cons e l))))
- (pna (prec-n-assc tree)))
- ;; We sweep through the grammar to generate a canonical specification.
- ;; Note: the local rhs is used to hold RHS terms, but a
- ;; value of @code{'()} is used to signal "add rule", and a value of
- ;; @code{#f} is used to signal ``done, proceed to next rule.''
- ;; We use @code{tail} below to go through all remaining rules so that any
- ;; like LHS get absorbed before proceeding: This keeps LHS in sequence.
- ;; Note: code-comm and lone-comm are added to terminals so that they end
- ;; up in the match-table. The parser will skip these if the automoton has
- ;; no associated transitions for these. This allows users to parse for
- ;; comments in some rules but skip the rest.
- (let iter ((tl '($error $end)) ; set of terminals
- (head gram) ; head of unprocessed productions
- (rhs-l '()) ; list of RHSs being processed
- (rhs #f)) ; RHS being processed
- (cond
- ((pair? rhs)
- (case (caar rhs)
- ((terminal)
- (iter (add-el (cdar rhs) tl) head rhs-l (cdr rhs)))
- (else
- (iter tl head rhs-l (cdr rhs)))))
- ((pair? rhs-l)
- (iter tl head (cdr rhs-l) (car rhs-l)))
- ((pair? head)
- (iter tl (cdr head) (car head) rhs-l))
- (else
- (simple-format #t "need to process terminals\n")
- (pretty-print pna)
- tl)))
- ))
-
-;; @end itemize
-;;; --- last line ---
+++ /dev/null
-nyacc/lang/c99/
-
-Copyright (C) 2015,2016 Matthew R. Wette
-
-Copying and distribution of this file, with or without modification,
-are permitted in any medium without royalty provided the copyright
-notice and this notice are preserved. This file is offered as-is,
-without any warranty.
-
-manifest:
-
-cpp.scm C preprocessor using tables
- includes: cppbody.scm cppact.scm,cpptab.scm
-cppbody.scm eval-cpp-expr procedure
-cppmach.scm CPP expression grammer, machine and act/tab file generation
-
-mach.scm C grammer, machine and act/tab file generation
- include: pbody.scm
- depends: cpp.scm
-parser.scm C file parser, using tables
- includes: body.scm, c99act.scm, c99tab.scm
- depends: cpp.scm
-xparser.scm C expression parser
- includes: body.scm, c99xact.scm, c99xtab.scm
- depends: cpp.scm
-
-pprint.scm C pretty printer, from SXML output of above parsers
-
-util1.scm utilities merge, remove trees from included files
-util2.scm utilities to process information in trees
-
-mach.d/
- cppact.scm cpp expression parser actions, generated from cppmach.scm
- cpptab.scm cpp expression parser tables, generated from cppmach.scm
-
- c99act.scm parser actions, generated from mach.scm
- c99tab.scm C99 parser tables, generated from mach.scm
-
- c99xact.scm expression parser actions, generated from mach.scm
- c99xtab.scm C99 expression parser tables, generated from mach.scm
-
-
-==== cpp ================================
-
-parse-cpp-line line => tree
\ No newline at end of file
+++ /dev/null
-;;; lang/c99/body.scm
-;;;
-;;; Copyright (C) 2015-2017 Matthew R. Wette
-;;;
-;;; This program is free software: you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation, either version 3 of the License, or
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;; Notes on the code design may be found in doc/nyacc/lang/c99-hg.info
-
-;; @section The C99 Parser Body
-;; This code provides the front end to the C99 parser, including the lexical
-;; analyzer and optional CPP processing. In @code{'file} mode the lex'er
-;; passes CPP statements to the parser; in @code{'code} mode the lex'er
-;; parses and evaluates the CPP statements. In the case of included files
-;; (e.g., via @code{#include <file.h>}) the include files are parsed if
-;; not in @code{inc-help}. The a-list @code{inc-help} maps
-;; include file names to typenames (e.g., @code{stdio.h} to @code{FILE}) and
-;; CPP defines (e.g., "INT_MAX=12344").
-
-(use-modules ((srfi srfi-9) #:select (define-record-type)))
-(use-modules ((sxml xpath) #:select (sxpath)))
-(use-modules (ice-9 pretty-print)) ;; for debugging
-
-(define-record-type cpi
- (make-cpi-1)
- cpi?
- (debug cpi-debug set-cpi-debug!) ; debug #t #f
- (defines cpi-defs set-cpi-defs!) ; #defines
- (incdirs cpi-incs set-cpi-incs!) ; #includes
- (inc-tynd cpi-itynd set-cpi-itynd!) ; a-l of incfile => typenames
- (inc-defd cpi-idefd set-cpi-idefd!) ; a-l of incfile => defines
- (ptl cpi-ptl set-cpi-ptl!) ; parent typename list
- (ctl cpi-ctl set-cpi-ctl!) ; current typename list
- ;;(brlev cpi-brlev set-cpi-brlev! ; curr brace level (#includes)
- )
-
-;;.@deffn Procedure split-cppdef defstr => (<name> . <repl>)| \
-;; (<name> <args> . <repl>)|#f
-;; Convert define string to a dict item. Examples:
-;; @example
-;; "ABC=123" => '("ABC" . "123")
-;; "MAX(X,Y)=((X)>(Y)?(X):(Y))" => ("MAX" ("X" "Y") . "((X)>(Y)?(X):(Y))")
-;; @end example
-;; @end deffn
-(define (split-cppdef defstr)
- (let ((x2st (string-index defstr #\()) ; start of args
- (x2nd (string-index defstr #\))) ; end of args
- (x3 (string-index defstr #\=))) ; start of replacement
- (cond
- ((not x3) #f)
- ((and x2st x3)
- ;;(if (not (eq? (1+ x2nd) x3)) (c99-err "bad CPP def: ~S" defstr))
- (cons* (substring defstr 0 x2st)
- (string-split
- (string-delete #\space (substring defstr (1+ x2st) x2nd))
- #\,)
- (substring defstr (1+ x3))))
- (else
- (cons (substring defstr 0 x3) (substring defstr (1+ x3)))))))
-#|
-(use-modules (ice-9 regex))
-(define split-cppdef
- (let ((rx1 (make-regexp "^([A-Za-z0-9_]+)\\(([^)]*)\\)=(.*)$"))
- (rx2 (make-regexp "^([A-Za-z0-9_]+)=(.*)$")))
- (lambda (defstr)
- (let* ()
- (cond
- ((regexp-exec rx1 defstr) =>
- (lambda (m1)
- (let* ((s1 (match:substring m1 1))
- (s2 (match:substring m1 2))
- (s3 (match:substring m1 3)))
- (cons* s1 (string-split s2 #\,) s3))))
- ((regexp-exec rx2 defstr) =>
- (lambda (m2)
- (let* ((s1 (match:substring m2 1))
- (s2 (match:substring m2 2)))
- (cons s1 s2))))
- (else #f)))))))
-|#
-
-;; @deffn Procedure make-cpi debug defines incdirs inchelp
-;; @end deffn
-(define (make-cpi debug defines incdirs inchelp)
- ;; convert inchelp into inc-file->typenames and inc-file->defines
- ;; Any entry for an include file which contains `=' is considered
- ;; a define; otherwise, the entry is a typename.
-
- (define (split-helper helper)
- (let ((file (car helper)))
- (let iter ((tyns '()) (defs '()) (ents (cdr helper)))
- (cond
- ((null? ents) (values (cons file tyns) (cons file defs)))
- ((split-cppdef (car ents)) =>
- (lambda (def) (iter tyns (cons def defs) (cdr ents))))
- (else (iter (cons (car ents) tyns) defs (cdr ents)))))))
-
- (let* ((cpi (make-cpi-1)))
- (set-cpi-debug! cpi debug) ; print states debug
- (set-cpi-defs! cpi (map split-cppdef defines)) ; list of define strings
- (set-cpi-incs! cpi incdirs) ; list of include dir's
- (set-cpi-ptl! cpi '()) ; list of lists of typenames
- (set-cpi-ctl! cpi '()) ; list of typenames
- ;; Break up the helpers into typenames and defines.
- (let iter ((itynd '()) (idefd '()) (helpers inchelp))
- (cond ((null? helpers)
- (set-cpi-itynd! cpi itynd)
- (set-cpi-idefd! cpi idefd))
- (else
- (call-with-values
- (lambda () (split-helper (car helpers)))
- (lambda (ityns idefs)
- (iter (cons ityns itynd) (cons idefs idefd) (cdr helpers)))))))
- ;; Assign builtins.
- (and=> (assoc-ref (cpi-itynd cpi) "__builtin")
- (lambda (tl) (set-cpi-ctl! cpi (append tl (cpi-ctl cpi)))))
- (and=> (assoc-ref (cpi-idefd cpi) "__builtin")
- (lambda (tl) (set-cpi-defs! cpi (append tl (cpi-defs cpi)))))
- ;; Return the populated info.
- cpi))
-
-(define *info* (make-fluid #f))
-
-;; @deffn {Procedure} typename? name
-;; Called by lexer to determine if symbol is a typename.
-;; Check current sibling for each generation.
-;; @end deffn
-(define (typename? name)
- (let ((cpi (fluid-ref *info*)))
- (if (member name (cpi-ctl cpi)) #t
- (let iter ((ptl (cpi-ptl cpi)))
- (if (null? ptl) #f
- (if (member name (car ptl)) #t
- (iter (cdr ptl))))))))
-
-;; @deffn {Procedure} add-typename name
-;; Helper for @code{save-typenames}.
-;; @end deffn
-(define (add-typename name)
- (let ((cpi (fluid-ref *info*)))
- (set-cpi-ctl! cpi (cons name (cpi-ctl cpi)))))
-
-(define (cpi-push) ;; on #if
- (let ((cpi (fluid-ref *info*)))
- (set-cpi-ptl! cpi (cons (cpi-ctl cpi) (cpi-ptl cpi)))
- (set-cpi-ctl! cpi '())))
-
-(define (cpi-shift) ;; on #elif #else
- (set-cpi-ctl! (fluid-ref *info*) '()))
-
-(define (cpi-pop) ;; on #endif
- (let ((cpi (fluid-ref *info*)))
- (set-cpi-ctl! cpi (append (cpi-ctl cpi) (car (cpi-ptl cpi))))
- (set-cpi-ptl! cpi (cdr (cpi-ptl cpi)))))
-
-;; @deffn {Procedure} find-new-typenames decl
-;; Helper for @code{save-typenames}.
-;; Given declaration return a list of new typenames (via @code{typedef}).
-;; @end deffn
-(define (find-new-typenames decl)
-
- ;; like declr->ident in util2.scm
- (define (declr->id-name declr)
- (case (car declr)
- ((ident) (sx-ref declr 1))
- ((init-declr) (declr->id-name (sx-ref declr 1)))
- ((comp-declr) (declr->id-name (sx-ref declr 1)))
- ((array-of) (declr->id-name (sx-ref declr 1)))
- ((ptr-declr) (declr->id-name (sx-ref declr 2)))
- ((ftn-declr) (declr->id-name (sx-ref declr 1)))
- ((scope) (declr->id-name (sx-ref declr 1)))
- (else (error "coding bug: " declr))))
-
- (let* ((spec (sx-ref decl 1))
- (stor (sx-find 'stor-spec spec))
- (id-l (sx-ref decl 2)))
- (if (and stor (eqv? 'typedef (caadr stor)))
- (let iter ((res '()) (idl (cdr id-l)))
- (if (null? idl) res
- (iter (cons (declr->id-name (sx-ref (car idl) 1)) res)
- (cdr idl))))
- '())))
-
-;; @deffn {Procedure} save-typenames decl
-;; Save the typenames for the lexical analyzer and return the decl.
-;; @end deffn
-(define (save-typenames decl)
- ;; This finds typenames using @code{find-new-typenames} and adds via
- ;; @code{add-typename}. Then return the decl.
- (for-each add-typename (find-new-typenames decl))
- decl)
-
-;; ------------------------------------------------------------------------
-
-(define (c99-err . args)
- (apply throw 'c99-error args))
-
-;; @deffn {Procedure} read-cpp-line ch => #f | (cpp-xxxx)??
-;; Given if ch is #\# read a cpp-statement.
-;; The standard implies that comments are tossed here but we keep them
-;; so that they can end up in the pretty-print output.
-;; @end deffn
-(define (read-cpp-line ch)
- (if (not (eq? ch #\#)) #f
- (let iter ((cl '()) (ch (read-char)))
- (cond
- ((eof-object? ch) (throw 'cpp-error "CPP lines must end in newline"))
- ((eq? ch #\newline) (unread-char ch) (list->string (reverse cl)))
- ((eq? ch #\\)
- (let ((c2 (read-char)))
- (if (eq? c2 #\newline)
- (iter cl (read-char))
- (iter (cons* c2 ch cl) (read-char)))))
- ((eq? ch #\/) ;; swallow comments, event w/ newlines
- (let ((c2 (read-char)))
- (cond
- ((eqv? c2 #\*)
- (let iter2 ((cl2 (cons* #\* #\/ cl)) (ch (read-char)))
- (cond
- ((eq? ch #\*)
- (let ((c2 (read-char)))
- (if (eqv? c2 #\/)
- (iter (cons* #\/ #\* cl2) (read-char)) ;; keep comment
- (iter2 (cons #\* cl2) c2))))
- (else
- (iter2 (cons ch cl2) (read-char))))))
- (else
- (iter (cons #\/ cl) c2)))))
- (else (iter (cons ch cl) (read-char)))))))
-
-;; @deffn {Procedure} find-file-in-dirl file dirl => path
-;; @end deffn
-(define (find-file-in-dirl file dirl)
- (let iter ((dirl dirl))
- (if (null? dirl) #f
- (let ((p (string-append (car dirl) "/" file)))
- (if (access? p R_OK) p (iter (cdr dirl)))))))
-
-(define (def-xdef? name mode)
- (not (eqv? mode 'file)))
-
-;; @deffn {Procedure} gen-c-lexer [#:mode mode] [#:xdef? proc] => procedure
-;; Generate a context-sensitive lexer for the C99 language. The generated
-;; lexical analyzer reads and passes comments and optionally CPP statements
-;; to the parser. The keyword argument @var{mode} will determine if CPP
-;; statements are passed (@code{'file} mode) or parsed and executed
-;; (@code{'file} mode) as described above. Comments will be passed as
-;; ``line'' comments or ``lone'' comments: lone comments appear on a line
-;; without code. The @code{xdef?} keyword argument allows user to pass
-;; a predicate which determines whether CPP symbols in code are expanded.
-;; The default predicate is
-;; @example
-;; (define (def-xdef? mode name) (eqv? mode 'code))
-;; @end example
-;; @end deffn
-(define gen-c-lexer
- ;; This gets ugly in order to handle cpp.
- ;;.need to add support for num's w/ letters like @code{14L} and @code{1.3f}.
- ;; todo: I think there is a bug wrt the comment reader because // ... \n
- ;; will end up in same mode... so after
- ;; int x; // comment
- ;; the lexer will think we are not at BOL.
- (let* ((match-table c99-mtab)
- (read-ident read-c-ident)
- (read-comm read-c-comm)
- ;;
- (ident-like? (make-ident-like-p read-ident))
- ;;
- (strtab (filter-mt string? match-table)) ; strings in grammar
- (kwstab (filter-mt ident-like? strtab)) ; keyword strings =>
- (keytab (map-mt string->symbol kwstab)) ; keywords in grammar
- (chrseq (remove-mt ident-like? strtab)) ; character sequences
- (symtab (filter-mt symbol? match-table)) ; symbols in grammar
- (chrtab (filter-mt char? match-table)) ; characters in grammar
- ;;
- (read-chseq (make-chseq-reader chrseq))
- (assc-$ (lambda (pair) (cons (assq-ref symtab (car pair)) (cdr pair))))
- ;;
- (t-ident (assq-ref symtab '$ident))
- (t-typename (assq-ref symtab 'typename))
- (xp1 (sxpath '(cpp-stmt define)))
- (xp2 (sxpath '(decl))))
- ;; mode: 'code|'file|'decl
- ;; xdef?: (proc name mode) => #t|#f : do we expand #define?
- (lambda* (#:key (mode 'code) (xdef? #f))
- (let ((bol #t) ; begin-of-line condition
- (xtxt #f) ; parsing cpp expanded text (kludge?)
- (ppxs (list 'keep)) ; CPP execution state stack
- (info (fluid-ref *info*)) ; info shared w/ parser
- (brlev 0) ; brace level
- (x-def? (or xdef? def-xdef?))
- )
- ;; Return the first (tval . lval) pair not excluded by the CPP.
- (lambda ()
-
- (define (add-define tree)
- (let* ((tail (cdr tree))
- (name (car (assq-ref tail 'name)))
- (args (assq-ref tail 'args))
- (repl (car (assq-ref tail 'repl)))
- (cell (cons name (if args (cons args repl) repl))))
- (set-cpi-defs! info (cons cell (cpi-defs info)))))
-
- (define (rem-define name)
- (set-cpi-defs! info (delete name (cpi-defs info))))
-
- (define (apply-helper file)
- (let* ((tyns (assoc-ref (cpi-itynd info) file))
- (defs (assoc-ref (cpi-idefd info) file)))
- ;;(simple-format #t "apply-helper ~S => ~S\n" file tyns)
- ;;(simple-format #t " itynd= ~S\n" (cpi-itynd info))
- (when tyns
- (for-each add-typename tyns)
- (set-cpi-defs! info (append defs (cpi-defs info))))
- tyns))
-
- (define (inc-stmt->file stmt)
- (let* ((arg (cadr stmt)) (len (string-length arg)))
- (substring arg 1 (1- len))))
-
- (define (inc-file->path file)
- (find-file-in-dirl file (cpi-incs info)))
-
- (define (code-if stmt)
- ;;(simple-format #t "code-if: ppxs=~S\n" ppxs)
- (case (car ppxs)
- ((skip-look skip-done skip) ;; don't eval if excluded
- ;;(simple-format #t "code-if: SKIP\n")
- (set! ppxs (cons 'skip ppxs)))
- (else
- ;;(simple-format #t "code-if: KEEP\n")
- ;;(simple-format #t " text=~S\n" (cadr stmt))
- ;;(simple-format #t " defs=~S\n" (cpi-defs info))
- (let* ((defs (cpi-defs info))
- (val (eval-cpp-cond-text (cadr stmt) defs)))
- (if (not val) (c99-err "unresolved: ~S" (cadr stmt)))
- (if (eq? 'keep (car ppxs))
- (if (zero? val)
- (set! ppxs (cons 'skip-look ppxs))
- (set! ppxs (cons 'keep ppxs)))
- (set! ppxs (cons 'skip-done ppxs))))))
- stmt)
-
- (define (code-elif stmt)
- (case (car ppxs)
- ((skip) #t) ;; don't eval if excluded
- (else
- (let* ((defs (cpi-defs info))
- (val (eval-cpp-cond-text (cadr stmt) defs)))
- (if (not val) (c99-err "unresolved: ~S" (cadr stmt)))
- (case (car ppxs)
- ((skip-look) (if (not (zero? val)) (set-car! ppxs 'keep)))
- ((keep) (set-car! ppxs 'skip-done))))))
- stmt)
-
- (define (code-else stmt)
- (case (car ppxs)
- ((skip-look) (set-car! ppxs 'keep))
- ((keep) (set-car! ppxs 'skip-done)))
- stmt)
-
- (define (code-endif stmt)
- (set! ppxs (cdr ppxs))
- stmt)
-
- (define (eval-cpp-incl/here stmt) ;; => stmt
- ;; include file inplace
- (let* ((file (inc-stmt->file stmt))
- (path (inc-file->path file)))
- (cond
- ((apply-helper file))
- ((not path) (c99-err "not found: ~S" file)) ; file not found
- (else (set! bol #t) (push-input (open-input-file path))))
- stmt))
-
- (define (eval-cpp-incl/tree stmt) ;; => stmt
- ;; include file as a new tree
- (let* ((file (inc-stmt->file stmt))
- (path (inc-file->path file)))
- (cond
- ((apply-helper file) stmt) ; use helper
- ((not path) (c99-err "not found: ~S" file)) ; file not found
- ((with-input-from-file path run-parse) => ; add tree to stmt
- (lambda (tree)
- ;;(pretty-print tree (current-error-port))
- ;;(pretty-print (xp1 tree))
- (for-each add-define (xp1 tree))
- (append stmt tree))))))
-
- (define (eval-cpp-stmt/code stmt) ;; => stmt
- (case (car stmt)
- ((if) (code-if stmt))
- ((elif) (code-elif stmt))
- ((else) (code-else stmt))
- ((endif) (code-endif stmt))
- (else
- (if (eqv? 'keep (car ppxs))
- (case (car stmt)
- ((include) (eval-cpp-incl/here stmt))
- ((define) (add-define stmt) stmt)
- ((undef) (rem-define (cadr stmt)) stmt)
- ((error) (c99-err "error: #error ~A" (cadr stmt)))
- ((pragma) stmt) ;; ignore for now
- (else (error "bad cpp flow stmt")))))))
-
- (define (eval-cpp-stmt/decl stmt) ;; => stmt
- (case (car stmt)
- ((if) (code-if stmt))
- ((elif) (code-elif stmt))
- ((else) (code-else stmt))
- ((endif) (code-endif stmt))
- (else
- (if (eqv? 'keep (car ppxs))
- (case (car stmt)
- ((include) ; use tree unless inside braces
- (if (zero? brlev)
- (eval-cpp-incl/tree stmt)
- (eval-cpp-incl/here stmt)))
- ((define) (add-define stmt) stmt)
- ((undef) (rem-define (cadr stmt)) stmt)
- ((error) (c99-err "error: #error ~A" (cadr stmt)))
- ((pragma) stmt) ;; ignore for now
- (else (error "bad cpp flow stmt")))
- stmt))))
-
- (define (eval-cpp-stmt/file stmt) ;; => stmt
- (case (car stmt)
- ((if) (cpi-push) stmt)
- ((elif else) (cpi-shift) stmt)
- ((endif) (cpi-pop) stmt)
- ((include) (eval-cpp-incl/tree stmt))
- ((define) (add-define stmt) stmt)
- ((undef) (rem-define (cadr stmt)) stmt)
- ((error) stmt)
- ((pragma) stmt) ;; need to work this
- (else (error "bad cpp flow stmt"))))
-
- ;; Maybe evaluate the CPP statement.
- (define (eval-cpp-stmt stmt)
- (with-throw-handler
- 'cpp-error
- (lambda ()
- (case mode
- ((code) (eval-cpp-stmt/code stmt))
- ((decl) (eval-cpp-stmt/decl stmt))
- ((file) (eval-cpp-stmt/file stmt))
- (else (error "lang/c99 coding error"))))
- (lambda (key fmt . rest)
- (report-error fmt rest)
- (throw 'c99-error "CPP error"))))
-
- ;; Predicate to determine if we pass the cpp-stmt to the parser.
- ;; @itemize
- ;; If code mode, never
- ;; If file mode, all except includes between { }
- ;; If decl mode, only defines and includes outside {}
- ;; @end itemize
- (define (pass-cpp-stmt? stmt)
- (case mode
- ((code) #f)
- ((decl) (and (zero? brlev) (memq (car stmt) '(include define))))
- ((file) (or (zero? brlev) (not (eqv? (car stmt) 'include))))
- (else (error "lang/c99 coding error"))))
-
- ;; Composition of @code{read-cpp-line} and @code{eval-cpp-line}.
- (define (read-cpp-stmt ch)
- (and=> (read-cpp-line ch) cpp-line->stmt))
-
- (define (read-token)
- (let iter ((ch (read-char)))
- (cond
- ((eof-object? ch)
- (set! xtxt #f)
- (if (pop-input) (iter (read-char)) (assc-$ '($end . ""))))
- ((eq? ch #\newline) (set! bol #t) (iter (read-char)))
- ((char-set-contains? c:ws ch) (iter (read-char)))
- (bol
- (set! bol #f)
- (cond ;; things that depend on bol only
- ((read-comm ch #t) => assc-$)
- ((read-cpp-stmt ch) =>
- (lambda (stmt)
- (let ((stmt (eval-cpp-stmt stmt))) ; eval can add tree
- (if (pass-cpp-stmt? stmt)
- (assc-$ `(cpp-stmt . ,stmt))
- (iter (read-char))))))
- (else (iter ch))))
- ((read-ident ch) =>
- (lambda (name)
- (let ((symb (string->symbol name)))
- ;;(simple-format #t "id: name=~S xtxt=~S\n" name xtxt)
- (cond
- ((and (not xtxt)
- (if (procedure? x-def?) (x-def? name mode) x-def?)
- (expand-cpp-macro-ref name (cpi-defs info)))
- => (lambda (st)
- ;;(simple-format #t "repl=~S\n" st)
- (set! xtxt #t) ; so we don't re-expand
- (push-input (open-input-string st))
- (iter (read-char))))
- ((assq-ref keytab symb)
- => (lambda (t) (cons t name)))
- ((typename? name)
- (cons (assq-ref symtab 'typename) name))
- (else
- (cons (assq-ref symtab '$ident) name))))))
- ((read-c-num ch) => assc-$)
- ((read-c-string ch) => assc-$)
- ((read-c-chlit ch) => assc-$)
- ((read-comm ch #f) => assc-$)
- ((and (char=? ch #\{) (set! brlev (1+ brlev)) #f) #f)
- ((and (char=? ch #\}) (set! brlev (1- brlev)) #f) #f)
- ((read-chseq ch) => identity)
- ((assq-ref chrtab ch) => (lambda (t) (cons t (string ch))))
- ((eqv? ch #\\) ;; C allows \ at end of line to continue
- (let ((ch (read-char)))
- (cond ((eqv? #\newline ch) (iter (read-char))) ;; extend line
- (else (unread-char ch) (cons #\\ "\\"))))) ;; parse err
- (else (cons ch (string ch))))))
-
- ;; Loop between reading tokens and skipping tokens via CPP logic.
- (let iter ((pair (read-token)))
- (case (car ppxs)
- ((keep) ;;(simple-format #t "lx=>~S\n" pair)
- pair)
- ((skip-done skip-look skip)
- (iter (read-token)))
- (else (error "coding error"))))
- )))))
-
-;; --- last line ---
+++ /dev/null
-;;; lang/c/cpp.scm
-;;;
-;;; Copyright (C) 2015-2017 Matthew R. Wette
-;;;
-;;; This program is free software: you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation, either version 3 of the License, or
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;; C preprocessor macro expansion and condition text parse-and-eval
-;; ref: https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html
-
-(define-module (nyacc lang c99 cpp)
- #:export (
- cpp-line->stmt
- eval-cpp-cond-text
- expand-cpp-macro-ref)
- #:use-module (nyacc parse)
- #:use-module (nyacc lex)
- #:use-module (nyacc lang util)
- #:use-module (rnrs arithmetic bitwise)
- #:use-module (ice-9 match)
- #:use-module (system base pmatch)
- )
-
-(define c99-std-defs
- '("__DATE__" "__FILE__" "__LINE__" "__STDC__" "__STDC_HOSTED__"
- "__STDC_VERSION__" "__TIME__"))
-
-(define (c99-std-def? str)
- (let iter ((defs c99-std-defs))
- (cond
- ((null? defs) #f)
- ((string=? (car defs) str) #t)
- (else (iter (cdr defs))))))
-
-(define (c99-std-val str)
- (cond
- ((string=? str "__DATE__") "M01 01 2001")
- ((string=? str "__FILE__") "(unknown)")
- ((string=? str "__LINE__") "0")
- ((string=? str "__STDC__") "1")
- ((string=? str "__STDC_HOSTED__") "0")
- ((string=? str "__STDC_VERSION__") "201701")
- ((string=? str "__TIME__") "00:00:00")
- (else #f)))
-
-(define inline-whitespace (list->char-set '(#\space #\tab)))
-
-;;.@deffn {Procedure} skip-il-ws ch
-;; Skip in-line whitespace
-;; @end deffn
-(define (skip-il-ws ch)
- (cond
- ((eof-object? ch) ch)
- ((char-set-contains? inline-whitespace ch) (skip-il-ws (read-char)))
- (else ch)))
-
-;; @deffn {Procedure} read-ellipsis ch
-;; read ellipsis
-;; @end deffn
-(define (read-ellipsis ch)
- (cond
- ((eof-object? ch) #f)
- ((char=? ch #\.) (read-char) (read-char) "...") ; assumes correct syntax
- (else #f)))
-
-;; @deffn {Procedure} cpp-define
-;; Reads CPP define from current input and generates a cooresponding sxml
-;; expression.
-;; @example
-;; (define (name "ABC") (repl "123"))
-;; OR
-;; (define (name "ABC") (args "X" "Y") (repl "X+Y"))
-;; @example
-;; @end deffn
-(define (cpp-define)
-
- (define (p-args la) ;; parse args
- (if (eq? la #\()
- (let iter ((args '()) (la (skip-il-ws (read-char))))
- (cond
- ((eq? la #\)) (reverse args))
- ((read-c-ident la) =>
- (lambda (arg) (iter (cons arg args) (skip-il-ws (read-char)))))
- ((read-ellipsis la) =>
- (lambda (arg) (iter (cons arg args) (skip-il-ws (read-char)))))
- ((eq? la #\,) (iter args (skip-il-ws (read-char))))))
- (begin (if (char? la) (unread-char la)) #f)))
-
- (define (p-rest la) ;; parse rest
- (cond ((eof-object? la) "")
- (else (unread-char la) (drain-input (current-input-port)))))
-
- (let* ((name (read-c-ident (skip-il-ws (read-char))))
- (args (or (p-args (read-char)) '()))
- (repl (p-rest (skip-il-ws (read-char)))))
- (if (pair? args)
- `(define (name ,name) (args . ,args) (repl ,repl))
- `(define (name ,name) (repl ,repl)))))
-
-
-;; @deffn {Procedure} cpp-include
-;; Parse CPP include statement.
-(define (cpp-include)
- (let* ((beg-ch (skip-il-ws (read-char)))
- (end-ch (if (eq? beg-ch #\<) #\> #\"))
- (path (let iter ((cl (list beg-ch)) (ch (read-char)))
- (if (eq? ch end-ch) (list->string (reverse (cons ch cl)))
- (iter (cons ch cl) (read-char))))))
- `(include ,path)))
-
-;; @deffn {Procedure} cpp-line->stmt line defs => (stmt-type text)
-;; Parse a line from a CPP statement and return a parse tree.
-;; @example
-;; (parse-cpp-stmt "define X 123") => (define "X" "123")
-;; (parse-cpp-stmt "if defined(A) && defined(B) && defined(C)"
-;; => (if "defined(A) && defined(B) && defined(C)")
-;; @end example
-;; To evaluate the @code{if} statements use @code{parse-cpp-expr} and
-;; @code{eval-cpp-expr}.
-;; @end deffn
-(define (cpp-line->stmt line)
- (define (rd-ident) (read-c-ident (skip-il-ws (read-char))))
- (define (rd-num) (and=> (read-c-num (skip-il-ws (read-char))) cdr))
- (define (rd-rest) (let ((ch (skip-il-ws (read-char))))
- (if (not (eof-object? ch)) (unread-char ch))
- (drain-input (current-input-port))))
- (with-input-from-string line
- (lambda ()
- (let ((cmd (string->symbol (read-c-ident (skip-il-ws (read-char))))))
- (case cmd
- ((include) (cpp-include))
- ((define) (cpp-define))
- ((undef) `(undef ,(rd-ident)))
- ((ifdef)
- `(if ,(string-append "defined(" (rd-ident) ")" (rd-rest))))
- ((ifndef)
- `(if ,(string-append "!defined(" (rd-ident) ")" (rd-rest))))
- ((if elif else endif line error pragma) (list cmd (rd-rest)))
- (else '(unknown "")))))))
-
-(include-from-path "nyacc/lang/c99/mach.d/cpptab.scm")
-(include-from-path "nyacc/lang/c99/mach.d/cppact.scm")
-
-(define raw-parser
- (make-lalr-parser
- (list (cons 'len-v cpp-len-v) (cons 'pat-v cpp-pat-v) (cons 'rto-v cpp-rto-v)
- (cons 'mtab cpp-mtab) (cons 'act-v cpp-act-v))))
-
-(define (cpp-err fmt . args)
- (apply throw 'cpp-error fmt args))
-
-;; Since we want to be able to get CPP statements with comment in tact
-;; (e.g., for passing to @code{pretty-print-c99}) we need to remove
-;; comments when parsing CPP expressions. We convert a comm-reader
-;; into a comm-skipper here. And from that generate a lexer generator.
-(define cpp-comm-skipper
- (let ((reader (make-comm-reader '(("/*" . "*/")))))
- (lambda (ch)
- (reader ch #f))))
-
-;; generate a lexical analyzer per string
-(define gen-cpp-lexer
- (make-lexer-generator cpp-mtab #:comm-skipper cpp-comm-skipper))
-
-;; @deffn {Procedure} parse-cpp-expr text => tree
-;; Given a string returns a cpp parse tree. This is called by
-;; @code{eval-cpp-expr}. The text will have had all CPP defined symbols
-;; expanded already so no identifiers should appear in the text.
-;; A @code{cpp-error} will be thrown if a parse error occurs.
-;; @end deffn
-(define (parse-cpp-expr text)
- (with-throw-handler
- 'nyacc-error
- (lambda ()
- (with-input-from-string text
- (lambda () (raw-parser (gen-cpp-lexer)))))
- (lambda (key fmt . args)
- (apply throw 'cpp-error fmt args))))
-
-;; @deffn {Procedure} eval-cpp-expr tree dict => datum
-;; Evaluate a tree produced from @code{parse-cpp-expr}.
-;; The tree passed to this routine is
-;; @end deffn
-(define (eval-cpp-expr tree dict)
- (letrec
- ((tx (lambda (tr ix) (list-ref tr ix)))
- (tx1 (lambda (tr) (tx tr 1)))
- (ev (lambda (ex ix) (eval-expr (list-ref ex ix))))
- (ev1 (lambda (ex) (ev ex 1))) ; eval expr in arg 1
- (ev2 (lambda (ex) (ev ex 2))) ; eval expr in arg 2
- (ev3 (lambda (ex) (ev ex 3))) ; eval expr in arg 3
- (eval-expr
- (lambda (tree)
- (case (car tree)
- ((fixed) (string->number (cnumstr->scm (tx1 tree))))
- ((char) (char->integer (tx1 tree)))
- ((defined) (if (assoc-ref dict (tx1 tree)) 1 0))
- ((pre-inc post-inc) (1+ (ev1 tree)))
- ((pre-dec post-dec) (1- (ev1 tree)))
- ((pos) (ev1 tree))
- ((neg) (- (ev1 tree)))
- ((bw-not) (bitwise-not (ev1 tree)))
- ((not) (if (zero? (ev1 tree)) 1 0))
- ((mul) (* (ev1 tree) (ev2 tree)))
- ((div) (/ (ev1 tree) (ev2 tree)))
- ((mod) (modulo (ev1 tree) (ev2 tree)))
- ((add) (+ (ev1 tree) (ev2 tree)))
- ((sub) (- (ev1 tree) (ev2 tree)))
- ((lshift) (bitwise-arithmetic-shift-left (ev1 tree) (ev2 tree)))
- ((rshift) (bitwise-arithmetic-shift-right (ev1 tree) (ev2 tree)))
- ((lt) (if (< (ev1 tree) (ev2 tree)) 1 0))
- ((le) (if (<= (ev1 tree) (ev2 tree)) 1 0))
- ((gt) (if (> (ev1 tree) (ev2 tree)) 1 0))
- ((ge) (if (>= (ev1 tree) (ev2 tree)) 1 0))
- ((equal) (if (= (ev1 tree) (ev2 tree)) 1 0))
- ((noteq) (if (= (ev1 tree) (ev2 tree)) 0 1))
- ((bw-or) (bitwise-ior (ev1 tree) (ev2 tree)))
- ((bw-xor) (bitwise-xor (ev1 tree) (ev2 tree)))
- ((bw-and) (bitwise-and (ev1 tree) (ev2 tree)))
- ((or) (if (and (zero? (ev1 tree)) (zero? (ev2 tree))) 0 1))
- ((and) (if (or (zero? (ev1 tree)) (zero? (ev2 tree))) 0 1))
- ((cond-expr) (if (zero? (ev1 tree)) (ev3 tree) (ev2 tree)))
- ((ident) (cpp-err "undefined identifier: ~S" (cadr tree)))
- (else (error "incomplete implementation"))))))
- (eval-expr tree)))
-
-;;.@deffn {Procedure} rtokl->string reverse-token-list => string
-;; Convert reverse token-list to string.
-;; @end deffn
-(define (rtokl->string tokl)
-
- ;; Turn reverse chl into a string and insert it into the string list stl.
- (define (add-chl chl stl)
- (if (null? chl) stl (cons (list->string chl) stl)))
-
- ;;(simple-format #t "\nused=~S\n" used)
- ;; Works like this: Scan through the list of tokens (key-val pairs or
- ;; lone characters). Lone characters are collected in a list (@code{chl});
- ;; pairs are converted into strings and combined with list of characters
- ;; into a list of strings. When done the list of strings is combined to
- ;; one string. (The token 'argval is expansion of argument.)
- (let iter ((stl '()) ; list of strings to reverse-append
- (chl '()) ; char list
- (nxt #f) ; next string to add after chl
- (tkl tokl)) ; input token list
- (cond
- (nxt
- (iter (cons nxt (add-chl chl stl)) '() #f tkl))
- ((null? tkl)
- (apply string-append (add-chl chl stl)))
- ((char? (car tkl))
- (iter stl (cons (car tkl) chl) nxt (cdr tkl)))
- (else
- (pmatch tkl
- (((ident . ,rval) dhash (ident . ,lval) . ,rest)
- (iter stl chl nxt
- (acons 'ident (string-append lval rval) (list-tail tkl 3))))
- (((ident . ,arg) hash . ,rest)
- (iter stl chl (string-append "\"" arg "\"") (list-tail tkl 2)))
- (((ident . ,iden) (ident . ,lval) . ,rest)
- (iter stl chl iden rest))
- (((ident . ,iden) . ,rest)
- (iter stl chl iden rest))
- (((string . ,val) . ,rest)
- (iter stl (cons #\" chl) val (cons #\" rest)))
- (((defined . ,val) . ,rest)
- (iter stl chl val rest))
- ((space space . ,rest)
- (iter stl chl nxt rest))
- ((space . ,rest)
- (iter stl (cons #\space chl) nxt rest))
- ((,asis . ,rest)
- (iter stl chl asis rest))
- (,otherwise
- (error "no match" tkl)))))))
-
-;; We just scanned "defined", now need to scan the arg to inhibit expansion.
-;; For example, we have scanned "defined"; we now scan "(FOO)" or "FOO", and
-;; return "defined(FOO)" or "defined FOO".
-(define (scan-defined-arg)
- (let* ((ch (skip-il-ws (read-char))) (no-ec (not (char=? ch #\())))
- (let iter ((chl (list ch)) (ch (skip-il-ws (read-char))))
- (cond
- ((eof-object? ch)
- (if no-ec
- (string-append "defined " (list->string (reverse chl)))
- (cpp-err "illegal argument to `defined'")))
- ((char-set-contains? c:ir ch)
- (iter (cons ch chl) (read-char)))
- (no-ec
- (unread-char ch)
- (string-append "defined " (list->string (reverse chl))))
- ((char=? #\) (skip-il-ws ch))
- (string-append "defined" (list->string (reverse (cons #\) chl)))))
- (else
- (cpp-err "illegal argument to `defined'"))))))
-
-(define (scan-cpp-input defs used end-tok)
- ;; Works like this: scan for tokens (comments, parens, strings, char's, etc).
- ;; Tokens are collected in a (reverse ordered) list (tkl) and merged together
- ;; to a string on return using @code{rtokl->string}. Keep track of expanded
- ;; identifiers and rerun if something got expanded. Also, keep track of
- ;; ## and spaces so that we can parse ID /* foo */ ## /* bar */ 123
- ;; as well as ABC/*foo*/(123,456).
-
- (define (trim-spaces tkl)
- (if (and (pair? tkl) (eqv? 'space (car tkl)))
- (trim-spaces (cdr tkl))
- tkl))
-
- (define (finish rr tkl)
- (let* ((tkl (if end-tok (trim-spaces tkl) tkl))
- (repl (rtokl->string tkl)))
- ;;(if (null? rr) (simple-format #t "finish ~S\n" tkl))
- (if (pair? rr)
- (expand-cpp-repl repl defs (append rr used)) ;; re-run
- repl)))
-
- ;;(simple-format #t "scan-cpp-input end-tok=~S\n" end-tok)
- (let iter ((rr '()) ; list symbols resolved
- (tkl '()) ; token list of
- (lv 0) ; level
- (ch (skip-il-ws (read-char)))) ; next character
- ;;(unless end-tok (simple-format #t "tkl=~S ch=~S\n" tkl ch))
- (cond
- ((eof-object? ch) (finish rr tkl))
- ((and (eqv? end-tok ch) (zero? lv))
- (unread-char ch) (finish rr tkl))
- ((and end-tok (char=? #\) ch) (zero? lv))
- (unread-char ch) (finish rr tkl))
- ((or (char-set-contains? c:ws ch) ; whitespace
- (read-c-comm ch #f)) ; comment
- (iter rr (cons 'space tkl) lv (skip-il-ws (read-char))))
- ((read-c-ident ch) =>
- (lambda (iden)
- (if (equal? iden "defined")
- (iter rr (acons 'defined (scan-defined-arg) tkl) lv (read-char))
- (let ((rval (expand-cpp-macro-ref iden defs used)))
- (if rval
- (iter #t (cons rval tkl) lv (read-char))
- (iter rr (acons 'ident iden tkl) lv (read-char)))))))
- ((read-c-string ch) =>
- (lambda (st) (iter rr (acons 'string (cdr st) tkl) lv (read-char))))
- ((char=? #\( ch) (iter rr (cons ch tkl) (1+ lv) (read-char)))
- ((char=? #\) ch) (iter rr (cons ch tkl) (1- lv) (read-char)))
- (else
- (iter rr (cons ch tkl) lv (read-char))))))
-
-;; @deffn {Procedure} collect-args arglargd defs used => argd
-;; Collect arguments to a macro which appears in C code. If not looking at
-;; @code{(} return @code{#f}, else scan and eat up to closing @code{)}.
-;; If multiple whitespace characters are skipped at the front then only
-;; one @code{#\space} is re-inserted.
-;; @end deffn
-(define (collect-args argl defs used)
- (let iter1 ((sp #f) (ch (read-char)))
- (cond
- ((eof-object? ch) (if sp (unread-char #\space)) #f)
- ((char-set-contains? inline-whitespace ch) (iter1 #t (read-char)))
- ((char=? #\( ch)
- (let iter2 ((argl argl) (argv '()) (ch ch))
- (cond
- ((eqv? ch #\)) (reverse argv))
- ((null? argl) (cpp-err "arg count"))
- ((and (null? (cdr argl)) (string=? (car argl) "..."))
- (let ((val (scan-cpp-input defs used #\))))
- (iter2 (cdr argl) (acons "__VA_ARGS__" val argv) (read-char))))
- ((or (char=? ch #\() (char=? ch #\,))
- (let* ((val (scan-cpp-input defs used #\,)))
- (iter2 (cdr argl) (acons (car argl) val argv) (read-char))))
- (else
- (error "cpp.scm, collect-args: coding error")))))
- (else (if sp (unread-char #\space)) #f))))
-
-;; @deffn {Procedure} px-cpp-ftn-repl argd repl => string
-;; pre-expand CPP function where @var{argd} is an a-list of arg name
-;; and replacement and repl is the defined replacement
-;;
-;; argd is alist of arguments and token lists
-;; if end-tok == #f ignore levels
-;; ident space fixed float chseq hash dhash arg
-;; need to decide if we should use `(space ,tkl) or `((space) ,tkl)
-;; This should replace args and execute hash and double-hash ??
-;; @end deffn
-(define (px-cpp-ftn argd repl)
- (with-input-from-string repl
- (lambda ()
- ;;(simple-format #t "px-cpp-ftn argd=~S repl=~S\n" argd repl)
- (px-cpp-ftn-1 argd))))
-
-(define (px-cpp-ftn-1 argd)
-
- ;; Turn reverse chl into a string and insert it into the token stream.
- (define (ins-chl chl stl)
- (if (null? chl) stl (cons (list->string (reverse chl)) stl)))
-
- (define (rem-space chl)
- (let iter ((chl chl))
- (cond
- ((null? chl) chl)
- ((char-set-contains? c:ws (car chl)) (iter (cdr chl)))
- (else chl))))
-
- (define (mk-string str) (string-append "\"" str "\""))
-
- (let iter ((stl '()) ; string list
- (chl '()) ; character list
- (nxt #f) ; next string after char list
- (ch (read-char))) ; next character
- ;;(simple-format #t "px-1: stl=~S chl=~S nxt=~S ch=~S\n" stl chl nxt ch)
- (cond
- (nxt (iter (cons nxt (ins-chl chl stl)) '() #f ch))
- ((eof-object? ch)
- (apply string-append (reverse (ins-chl chl stl))))
- ((char-set-contains? c:ws ch)
- (iter stl (cons #\space chl) nxt (skip-il-ws (read-char))))
- ((read-c-comm ch #f) (iter stl (cons #\space chl) nxt (read-char)))
- ((read-c-string ch) =>
- (lambda (st) (iter stl chl (mk-string (cdr st)) (read-char))))
- ((char=? #\( ch) (iter stl (cons ch chl) nxt (read-char)))
- ((char=? #\) ch) (iter stl (cons ch chl) nxt (read-char)))
- ((read-c-ident ch) => ; replace if aval
- (lambda (iden)
- (iter stl chl (or (assoc-ref argd iden) iden) (read-char))))
- ((char=? #\# ch)
- (let ((ch (read-char)))
- (if (eqv? ch #\#)
- (iter stl (rem-space chl) nxt (skip-il-ws (read-char)))
- (let* ((aref (read-c-ident (skip-il-ws ch)))
- (aval (assoc-ref argd aref)))
- (if (not aref) (cpp-err "expecting arg-ref"))
- (if (not aval) (cpp-err "expecting arg-val"))
- (iter stl chl (mk-string aval) (read-char))))))
- (else (iter stl (cons ch chl) nxt (read-char))))))
-
-;; @deffn {Procedure} cpp-expand-text text defs [used] => string
-;; Expand the string @var{text} using the provided CPP @var{defs} a-list.
-;; Identifiers in the list of strings @var{used} will not be expanded.
-;; @end deffn
-(define* (cpp-expand-text text defs #:optional (used '()))
- ;;(simple-format #t "cpp-expand-text ~S\n" text)
- (with-input-from-string text
- (lambda () (scan-cpp-input defs used #f))))
-
-;; @deffn {Procedure} expand-cpp-repl
-;; to be documented
-;; @end deffn
-(define (expand-cpp-repl text defs used)
- ;;(simple-format #t "expand-cpp-repl text=~S used=~S\n" text used)
- (with-input-from-string text
- (lambda () (scan-cpp-input defs used #f))))
-
-;; === exports =======================
-
-;; @deffn {Procedure} eval-cpp-cond-text text defs => string
-;; Evaluate CPP condition expression (text).
-;; @end deffn
-(define (eval-cpp-cond-text text defs)
- (with-throw-handler
- 'cpp-error
- (lambda ()
- (let* ((rhs (cpp-expand-text text defs))
- (exp (parse-cpp-expr rhs)))
- (eval-cpp-expr exp defs)))
- (lambda (key fmt . args)
- (report-error fmt args)
- (throw 'c99-error "CPP error"))))
-
-;; @deffn {Procedure} expand-cpp-macro-ref ident defs [used] => repl|#f
-;; Given an identifier seen in the current input, this checks for associated
-;; definition in @var{defs} (generated from CPP defines). If found as simple
-;; macro, the expansion is returned as a string. If @var{ident} refers
-;; to a macro with arguments, then the arguments will be read from the
-;; current input. The format of the @code{defs} entries are
-;; @example
-;; ("ABC" . "123")
-;; ("MAX" ("X" "Y") . "((X)>(Y)?(X):(Y))")
-;; @end example
-;; @end deffn
-(define* (expand-cpp-macro-ref ident defs #:optional (used '()))
- (let ((rval (assoc-ref defs ident)))
- ;;(simple-format #t "ex-mac-ref rval=~S\n" rval)
- (cond
- ((member ident used) #f)
- ((string? rval) (expand-cpp-repl rval defs (cons ident used)))
- ((pair? rval)
- ;;(simple-format #t "rval = ~S\n" rval)
- (and=> (collect-args (car rval) defs used)
- (lambda (argd)
- (expand-cpp-repl (px-cpp-ftn argd (cdr rval))
- defs (cons ident used)))))
- ((c99-std-val ident) => identity)
- (else #f))))
-
-;;; --- last line ---
+++ /dev/null
-;;; lang/c99/cppmach.scm
-;;;
-;;; Copyright (C) 2015,2016 Matthew R. Wette
-;;;
-;;; This program is free software: you can redistribute it and/or modify
-;;; it under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation, either version 3 of the License, or
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;; C preprocessor expression parser generator
-
-(define-module (nyacc lang c99 cppmach)
- #:export (cpp-spec cpp-mach gen-cpp-files)
- #:use-module (nyacc lalr)
- #:use-module (nyacc parse)
- #:use-module (nyacc lex)
- #:use-module (nyacc lang util)
- #:use-module ((srfi srfi-43) #:select (vector-map))
- #:use-module (rnrs arithmetic bitwise)
- )
-
-(define cpp-spec
- (lalr-spec
- (notice (string-append "Copyright (C) 2016,2017 Matthew R. Wette"
- lang-crn-lic))
- (expect 0)
- (start conditional-expression)
- (grammar
- (conditional-expression
- (logical-or-expression)
- (logical-or-expression "?" logical-or-expression ":" conditional-expression
- ($$ `(cond-expr ,$1 ,$3 ,$5))))
- (logical-or-expression
- (logical-and-expression)
- (logical-or-expression "||" logical-and-expression ($$ `(or ,$1 ,$3))))
- (logical-and-expression
- (bitwise-or-expression)
- (logical-and-expression "&&" bitwise-or-expression ($$ `(and ,$1 ,$3))))
- (bitwise-or-expression
- (bitwise-xor-expression)
- (bitwise-or-expression "|" bitwise-xor-expression
- ($$ `(bitwise-or ,$1 ,$3))))
- (bitwise-xor-expression
- (bitwise-and-expression)
- (bitwise-xor-expression "^" bitwise-and-expression
- ($$ `(bitwise-xor ,$1 ,$3))))
- (bitwise-and-expression
- (equality-expression)
- (bitwise-and-expression "&" equality-expression
- ($$ `(bitwise-and ,$1 ,$3))))
- (equality-expression
- (relational-expression)
- (equality-expression "==" relational-expression ($$ `(equal ,$1 ,$3)))
- (equality-expression "!=" relational-expression ($$ `(noteq ,$1 ,$3))))
- (relational-expression
- (shift-expression)
- (relational-expression "<" shift-expression ($$ `(lt ,$1 ,$3)))
- (relational-expression "<=" shift-expression ($$ `(le ,$1 ,$3)))
- (relational-expression ">" shift-expression ($$ `(gt ,$1 ,$3)))
- (relational-expression ">=" shift-expression ($$ `(ge ,$1 ,$3))))
- (shift-expression
- (additive-expression)
- (shift-expression "<<" additive-expression ($$ `(lshift ,$1 ,$3)))
- (shift-expression ">>" additive-expression ($$ `(rshift ,$1 ,$3))))
- (additive-expression
- (multiplicative-expression)
- (additive-expression "+" multiplicative-expression ($$ `(add ,$1 ,$3)))
- (additive-expression "-" multiplicative-expression ($$ `(sub ,$1 ,$3))))
- (multiplicative-expression
- (unary-expression)
- (multiplicative-expression "*" unary-expression ($$ `(mul ,$1 ,$3)))
- (multiplicative-expression "/" unary-expression ($$ `(div ,$1 ,$3)))
- (multiplicative-expression "%" unary-expression ($$ `(mod ,$1 ,$3))))
- (unary-expression
- (postfix-expression)
- ("-" unary-expression ($$ `(neg ,$2)))
- ("+" unary-expression ($$ `(pos ,$2)))
- ("!" unary-expression ($$ `(not ,$2)))
- ("~" unary-expression ($$ `(bitwise-not ,$2)))
- ("++" unary-expression ($$ `(pre-inc ,$2)))
- ("--" unary-expression ($$ `(pre-dec ,$2))))
- (postfix-expression
- (primary-expression)
- (postfix-expression "++" ($$ `(post-inc ,$1)))
- (postfix-expression "--" ($$ `(post-dec ,$1))))
- (primary-expression
- ($ident ($$ `(ident ,$1)))
- ($fixed ($$ `(fixed ,$1))) ; integer-constant
- ($chlit ($$ `(char ,$1))) ; char-constant
- ("defined" "(" $ident ")" ($$ `(defined ,$3)))
- ("defined" $ident ($$ `(defined ,$2)))
- ("(" expression-list ")" ($$ $2)))
- (expression-list
- (conditional-expression)
- (expression-list "," conditional-expression ($$ $3)))
- )))
-
-(define cpp-mach
- (compact-machine
- (hashify-machine
- (make-lalr-machine cpp-spec))))
-
-;;; =====================================
-
-;; @item gen-cpp-files [dir] => #t
-;; Update or generate the files @quot{cppact.scm} and @quot{cpptab.scm}.
-;; If there are no changes to existing files, no update occurs.
-(define (gen-cpp-files . rest)
- (define (lang-dir path)
- (if (pair? rest) (string-append (car rest) "/" path) path))
- (define (xtra-dir path)
- (lang-dir (string-append "mach.d/" path)))
-
- (write-lalr-actions cpp-mach (xtra-dir "cppact.scm.new") #:prefix "cpp-")
- (write-lalr-tables cpp-mach (xtra-dir "cpptab.scm.new") #:prefix "cpp-")
- (let ((a (move-if-changed (xtra-dir "cppact.scm.new")
- (xtra-dir "cppact.scm")))
- (b (move-if-changed (xtra-dir "cpptab.scm.new")
- (xtra-dir "cpptab.scm"))))
- (when (or a b)
- (system (string-append "touch " (lang-dir "cpp.scm"))))))
-
-;; --- last line ---
+++ /dev/null
-;; ./mach.d/c99act.scm
-
-;; Copyright (C) 2016,2017 Matthew R. Wette
-;;
-;; This software is covered by the GNU GENERAL PUBLIC LICENCE, Version 3,
-;; or any later version published by the Free Software Foundation. See
-;; the file COPYING included with the this distribution.
-
-(define c99-act-v
- (vector
- ;; $start => translation-unit
- (lambda ($1 . $rest) $1)
- ;; primary-expression => identifier
- (lambda ($1 . $rest) `(p-expr ,$1))
- ;; primary-expression => constant
- (lambda ($1 . $rest) `(p-expr ,$1))
- ;; primary-expression => string-literal
- (lambda ($1 . $rest) `(p-expr ,(tl->list $1)))
- ;; primary-expression => "(" expression ")"
- (lambda ($3 $2 $1 . $rest) $2)
- ;; postfix-expression => primary-expression
- (lambda ($1 . $rest) $1)
- ;; postfix-expression => postfix-expression "[" expression "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-ref ,$3 ,$1))
- ;; postfix-expression => postfix-expression "(" argument-expression-list...
- (lambda ($4 $3 $2 $1 . $rest)
- `(fctn-call ,$1 ,(tl->list $3)))
- ;; postfix-expression => postfix-expression "(" ")"
- (lambda ($3 $2 $1 . $rest)
- `(fctn-call ,$1 (expr-list)))
- ;; postfix-expression => postfix-expression "." identifier
- (lambda ($3 $2 $1 . $rest) `(d-sel ,$3 ,$1))
- ;; postfix-expression => postfix-expression "->" identifier
- (lambda ($3 $2 $1 . $rest) `(i-sel ,$3 ,$1))
- ;; postfix-expression => postfix-expression "++"
- (lambda ($2 $1 . $rest) `(post-inc ,$1))
- ;; postfix-expression => postfix-expression "--"
- (lambda ($2 $1 . $rest) `(post-dec ,$1))
- ;; postfix-expression => "(" type-name ")" "{" initializer-list "}"
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(comp-lit ,$2 ,(tl->list $5)))
- ;; postfix-expression => "(" type-name ")" "{" initializer-list "," "}"
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(comp-lit ,$2 ,(tl->list $5)))
- ;; argument-expression-list => assignment-expression
- (lambda ($1 . $rest) (make-tl 'expr-list $1))
- ;; argument-expression-list => argument-expression-list "," assignment-e...
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; argument-expression-list => arg-expr-hack
- (lambda ($1 . $rest) (make-tl 'expr-list $1))
- ;; argument-expression-list => argument-expression-list "," arg-expr-hack
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; arg-expr-hack => declaration-specifiers abstract-declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) $2))
- ;; arg-expr-hack => declaration-specifiers
- (lambda ($1 . $rest)
- `(param-decl ,(tl->list $1)))
- ;; unary-expression => postfix-expression
- (lambda ($1 . $rest) $1)
- ;; unary-expression => "++" unary-expression
- (lambda ($2 $1 . $rest) `(pre-inc ,$2))
- ;; unary-expression => "--" unary-expression
- (lambda ($2 $1 . $rest) `(pre-dec ,$2))
- ;; unary-expression => unary-operator cast-expression
- (lambda ($2 $1 . $rest) (list $1 $2))
- ;; unary-expression => "sizeof" unary-expression
- (lambda ($2 $1 . $rest) `(sizeof-expr ,$2))
- ;; unary-expression => "sizeof" "(" type-name ")"
- (lambda ($4 $3 $2 $1 . $rest) `(sizeof-type ,$3))
- ;; unary-operator => "&"
- (lambda ($1 . $rest) 'ref-to)
- ;; unary-operator => "*"
- (lambda ($1 . $rest) 'de-ref)
- ;; unary-operator => "+"
- (lambda ($1 . $rest) 'pos)
- ;; unary-operator => "-"
- (lambda ($1 . $rest) 'neg)
- ;; unary-operator => "~"
- (lambda ($1 . $rest) 'bitwise-not)
- ;; unary-operator => "!"
- (lambda ($1 . $rest) 'not)
- ;; cast-expression => unary-expression
- (lambda ($1 . $rest) $1)
- ;; cast-expression => "(" type-name ")" cast-expression
- (lambda ($4 $3 $2 $1 . $rest) `(cast ,$2 ,$4))
- ;; multiplicative-expression => cast-expression
- (lambda ($1 . $rest) $1)
- ;; multiplicative-expression => multiplicative-expression "*" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(mul ,$1 ,$3))
- ;; multiplicative-expression => multiplicative-expression "/" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(div ,$1 ,$3))
- ;; multiplicative-expression => multiplicative-expression "%" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(mod ,$1 ,$3))
- ;; additive-expression => multiplicative-expression
- (lambda ($1 . $rest) $1)
- ;; additive-expression => additive-expression "+" multiplicative-expression
- (lambda ($3 $2 $1 . $rest) `(add ,$1 ,$3))
- ;; additive-expression => additive-expression "-" multiplicative-expression
- (lambda ($3 $2 $1 . $rest) `(sub ,$1 ,$3))
- ;; shift-expression => additive-expression
- (lambda ($1 . $rest) $1)
- ;; shift-expression => shift-expression "<<" additive-expression
- (lambda ($3 $2 $1 . $rest) `(lshift ,$1 ,$3))
- ;; shift-expression => shift-expression ">>" additive-expression
- (lambda ($3 $2 $1 . $rest) `(rshift ,$1 ,$3))
- ;; relational-expression => shift-expression
- (lambda ($1 . $rest) $1)
- ;; relational-expression => relational-expression "<" shift-expression
- (lambda ($3 $2 $1 . $rest) `(lt ,$1 ,$3))
- ;; relational-expression => relational-expression ">" shift-expression
- (lambda ($3 $2 $1 . $rest) `(gt ,$1 ,$3))
- ;; relational-expression => relational-expression "<=" shift-expression
- (lambda ($3 $2 $1 . $rest) `(le ,$1 ,$3))
- ;; relational-expression => relational-expression ">=" shift-expression
- (lambda ($3 $2 $1 . $rest) `(ge ,$1 ,$3))
- ;; equality-expression => relational-expression
- (lambda ($1 . $rest) $1)
- ;; equality-expression => equality-expression "==" relational-expression
- (lambda ($3 $2 $1 . $rest) `(eq ,$1 ,$3))
- ;; equality-expression => equality-expression "!=" relational-expression
- (lambda ($3 $2 $1 . $rest) `(ne ,$1 ,$3))
- ;; bitwise-and-expression => equality-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-and-expression => bitwise-and-expression "&" equality-expression
- (lambda ($3 $2 $1 . $rest)
- `(bitwise-and ,$1 ,$3))
- ;; bitwise-xor-expression => bitwise-and-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-xor-expression => bitwise-xor-expression "^" bitwise-and-expr...
- (lambda ($3 $2 $1 . $rest)
- `(bitwise-xor ,$1 ,$3))
- ;; bitwise-or-expression => bitwise-xor-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-or-expression => bitwise-or-expression "|" bitwise-xor-expres...
- (lambda ($3 $2 $1 . $rest) `(bitwise-or ,$1 ,$3))
- ;; logical-and-expression => bitwise-or-expression
- (lambda ($1 . $rest) $1)
- ;; logical-and-expression => logical-and-expression "&&" bitwise-or-expr...
- (lambda ($3 $2 $1 . $rest) `(and ,$1 ,$3))
- ;; logical-or-expression => logical-and-expression
- (lambda ($1 . $rest) $1)
- ;; logical-or-expression => logical-or-expression "||" logical-and-expre...
- (lambda ($3 $2 $1 . $rest) `(or ,$1 ,$3))
- ;; conditional-expression => logical-or-expression
- (lambda ($1 . $rest) $1)
- ;; conditional-expression => logical-or-expression "?" expression ":" co...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(cond-expr ,$1 ,$3 ,$5))
- ;; assignment-expression => conditional-expression
- (lambda ($1 . $rest) $1)
- ;; assignment-expression => unary-expression assignment-operator assignm...
- (lambda ($3 $2 $1 . $rest)
- `(assn-expr ,$1 (op ,$2) ,$3))
- ;; assignment-operator => "="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "+="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "-="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "*="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "/="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "%="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "<<="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => ">>="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "&="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "^="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "|="
- (lambda ($1 . $rest) $1)
- ;; expression => assignment-expression
- (lambda ($1 . $rest) $1)
- ;; expression => expression "," assignment-expression
- (lambda ($3 $2 $1 . $rest)
- (if (eqv? 'comma-expr (sx-tag $1))
- (append $1 (list $3))
- `(comma-expr ,$1 ,$3)))
- ;; constant-expression => conditional-expression
- (lambda ($1 . $rest) $1)
- ;; declaration => declaration-specifiers init-declarator-list $P1 ";" op...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- (if (pair? $5) (append $3 (list $5)) $3))
- ;; declaration => declaration-specifiers ";" opt-code-comment
- (lambda ($3 $2 $1 . $rest)
- (if (pair? $3)
- `(decl ,(tl->list $1) ,(list $3))
- `(decl ,(tl->list $1))))
- ;; $P1 =>
- (lambda ($2 $1 . $rest)
- (save-typenames
- `(decl ,(tl->list $1) ,(tl->list $2))))
- ;; declaration-specifiers => storage-class-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => storage-class-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => type-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => type-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => type-qualifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => function-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => function-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; init-declarator-list => init-declarator
- (lambda ($1 . $rest)
- (make-tl 'init-declr-list $1))
- ;; init-declarator-list => init-declarator-list "," init-declarator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; init-declarator => declarator
- (lambda ($1 . $rest) `(init-declr ,$1))
- ;; init-declarator => declarator "=" initializer
- (lambda ($3 $2 $1 . $rest) `(init-declr ,$1 ,$3))
- ;; storage-class-specifier => "auto"
- (lambda ($1 . $rest) '(stor-spec (auto)))
- ;; storage-class-specifier => "extern"
- (lambda ($1 . $rest) '(stor-spec (extern)))
- ;; storage-class-specifier => "register"
- (lambda ($1 . $rest) '(stor-spec (register)))
- ;; storage-class-specifier => "static"
- (lambda ($1 . $rest) '(stor-spec (static)))
- ;; storage-class-specifier => "typedef"
- (lambda ($1 . $rest) '(stor-spec (typedef)))
- ;; type-specifier => "void"
- (lambda ($1 . $rest) '(type-spec (void)))
- ;; type-specifier => fixed-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => float-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => "_Bool"
- (lambda ($1 . $rest)
- '(type-spec (fixed-type "_Bool")))
- ;; type-specifier => complex-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => struct-or-union-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => enum-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => typedef-name
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; fixed-type-specifier => "short"
- (lambda ($1 . $rest) '(fixed-type "short"))
- ;; fixed-type-specifier => "short" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "short int"))
- ;; fixed-type-specifier => "signed" "short"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed short"))
- ;; fixed-type-specifier => "signed" "short" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed short int"))
- ;; fixed-type-specifier => "int"
- (lambda ($1 . $rest) '(fixed-type "int"))
- ;; fixed-type-specifier => "signed"
- (lambda ($1 . $rest) '(fixed-type "signed"))
- ;; fixed-type-specifier => "signed" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed int"))
- ;; fixed-type-specifier => "long"
- (lambda ($1 . $rest) '(fixed-type "long"))
- ;; fixed-type-specifier => "long" "int"
- (lambda ($2 $1 . $rest) '(fixed-type "long int"))
- ;; fixed-type-specifier => "signed" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed long"))
- ;; fixed-type-specifier => "signed" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed long int"))
- ;; fixed-type-specifier => "long" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "long long"))
- ;; fixed-type-specifier => "long" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "long long int"))
- ;; fixed-type-specifier => "signed" "long" "long"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed long long"))
- ;; fixed-type-specifier => "signed" "long" "long" "int"
- (lambda ($4 $3 $2 $1 . $rest)
- '(fixed-type "signed long long int"))
- ;; fixed-type-specifier => "unsigned" "short" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned short int"))
- ;; fixed-type-specifier => "unsigned" "short"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned short"))
- ;; fixed-type-specifier => "unsigned" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned int"))
- ;; fixed-type-specifier => "unsigned"
- (lambda ($1 . $rest) '(fixed-type "unsigned"))
- ;; fixed-type-specifier => "unsigned" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned long"))
- ;; fixed-type-specifier => "unsigned" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned long"))
- ;; fixed-type-specifier => "unsigned" "long" "long" "int"
- (lambda ($4 $3 $2 $1 . $rest)
- '(fixed-type "unsigned long long int"))
- ;; fixed-type-specifier => "unsigned" "long" "long"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned long long"))
- ;; fixed-type-specifier => "char"
- (lambda ($1 . $rest) '(fixed-type "char"))
- ;; fixed-type-specifier => "signed" "char"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed char"))
- ;; fixed-type-specifier => "unsigned" "char"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned char"))
- ;; float-type-specifier => "float"
- (lambda ($1 . $rest) '(float-type "float"))
- ;; float-type-specifier => "double"
- (lambda ($1 . $rest) '(float-type "double"))
- ;; float-type-specifier => "long" "double"
- (lambda ($2 $1 . $rest)
- '(float-type "long double"))
- ;; complex-type-specifier => "_Complex"
- (lambda ($1 . $rest) '(complex-type "_Complex"))
- ;; complex-type-specifier => "float" "_Complex"
- (lambda ($2 $1 . $rest)
- '(complex-type "float _Complex"))
- ;; complex-type-specifier => "double" "_Complex"
- (lambda ($2 $1 . $rest)
- '(complex-type "double _Complex"))
- ;; complex-type-specifier => "long" "double" "_Complex"
- (lambda ($3 $2 $1 . $rest)
- '(complex-type "long double _Complex"))
- ;; struct-or-union-specifier => "struct" ident-like "{" struct-declarati...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(struct-def ,$2 ,(tl->list $4)))
- ;; struct-or-union-specifier => "struct" "{" struct-declaration-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(struct-def ,(tl->list $3)))
- ;; struct-or-union-specifier => "struct" ident-like
- (lambda ($2 $1 . $rest) `(struct-ref ,$2))
- ;; struct-or-union-specifier => "union" ident-like "{" struct-declaratio...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(union-def ,$2 ,(tl->list $4)))
- ;; struct-or-union-specifier => "union" "{" struct-declaration-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(union-def ,(tl->list $3)))
- ;; struct-or-union-specifier => "union" ident-like
- (lambda ($2 $1 . $rest) `(union-ref ,$2))
- ;; ident-like => identifier
- (lambda ($1 . $rest) $1)
- ;; ident-like => typedef-name
- (lambda ($1 . $rest) `(ident ,(cdr $1)))
- ;; struct-declaration-list => struct-declaration
- (lambda ($1 . $rest) (make-tl 'field-list $1))
- ;; struct-declaration-list => lone-comment
- (lambda ($1 . $rest) (make-tl 'field-list $1))
- ;; struct-declaration-list => struct-declaration-list struct-declaration
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; struct-declaration-list => struct-declaration-list lone-comment
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; struct-declaration => specifier-qualifier-list struct-declarator-list...
- (lambda ($4 $3 $2 $1 . $rest)
- (if (pair? $4)
- `(comp-decl ,(tl->list $1) ,(tl->list $2) ,$4)
- `(comp-decl ,(tl->list $1) ,(tl->list $2))))
- ;; specifier-qualifier-list => type-specifier specifier-qualifier-list
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; specifier-qualifier-list => type-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; specifier-qualifier-list => type-qualifier specifier-qualifier-list
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; specifier-qualifier-list => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; struct-declarator-list => struct-declarator
- (lambda ($1 . $rest)
- (make-tl 'comp-declr-list $1))
- ;; struct-declarator-list => struct-declarator-list "," struct-declarator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; struct-declarator => declarator
- (lambda ($1 . $rest) `(comp-declr ,$1))
- ;; struct-declarator => declarator ":" constant-expression
- (lambda ($3 $2 $1 . $rest)
- `(comp-declr (bit-field ,$1 ,$3)))
- ;; struct-declarator => ":" constant-expression
- (lambda ($2 $1 . $rest)
- `(comp-declr (bit-field ,$2)))
- ;; enum-specifier => "enum" ident-like "{" enumerator-list "}"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(enum-def ,$2 ,(tl->list $4)))
- ;; enum-specifier => "enum" ident-like "{" enumerator-list "," "}"
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(enum-def ,$2 ,(tl->list $4)))
- ;; enum-specifier => "enum" "{" enumerator-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(enum-def ,(tl->list $3)))
- ;; enum-specifier => "enum" "{" enumerator-list "," "}"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(enum-def ,(tl->list $3)))
- ;; enum-specifier => "enum" ident-like
- (lambda ($2 $1 . $rest) `(enum-ref ,$2))
- ;; enumerator-list => enumerator
- (lambda ($1 . $rest) (make-tl 'enum-def-list $1))
- ;; enumerator-list => enumerator-list "," enumerator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; enumerator => identifier
- (lambda ($1 . $rest) `(enum-defn ,$1))
- ;; enumerator => identifier "=" constant-expression
- (lambda ($3 $2 $1 . $rest) `(enum-defn ,$1 ,$3))
- ;; type-qualifier => "const"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; type-qualifier => "volatile"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; type-qualifier => "restrict"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; function-specifier => "inline"
- (lambda ($1 . $rest) `(fctn-spec ,$1))
- ;; declarator => pointer direct-declarator
- (lambda ($2 $1 . $rest) `(ptr-declr ,$1 ,$2))
- ;; declarator => direct-declarator
- (lambda ($1 . $rest) $1)
- ;; direct-declarator => identifier
- (lambda ($1 . $rest) $1)
- ;; direct-declarator => "(" declarator ")"
- (lambda ($3 $2 $1 . $rest) `(scope ,$2))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3 ,$4))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3))
- ;; direct-declarator => direct-declarator "[" assignment-expression "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3))
- ;; direct-declarator => direct-declarator "[" "]"
- (lambda ($3 $2 $1 . $rest) `(array-of ,$1))
- ;; direct-declarator => direct-declarator "[" "static" type-qualifier-li...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(array-of
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))
- ,$5))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "stati...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(array-of
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$5))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "*" "]"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3 (var-len)))
- ;; direct-declarator => direct-declarator "[" "*" "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 (var-len)))
- ;; direct-declarator => direct-declarator "(" parameter-type-list ")"
- (lambda ($4 $3 $2 $1 . $rest)
- `(ftn-declr ,$1 ,(tl->list $3)))
- ;; direct-declarator => direct-declarator "(" identifier-list ")"
- (lambda ($4 $3 $2 $1 . $rest)
- `(ftn-declr ,$1 ,(tl->list $3)))
- ;; direct-declarator => direct-declarator "(" ")"
- (lambda ($3 $2 $1 . $rest)
- `(ftn-declr ,$1 (param-list)))
- ;; pointer => "*" type-qualifier-list
- (lambda ($2 $1 . $rest)
- `(pointer ,(tl->list $2)))
- ;; pointer => "*"
- (lambda ($1 . $rest) '(pointer))
- ;; pointer => "*" type-qualifier-list pointer
- (lambda ($3 $2 $1 . $rest)
- `(pointer ,(tl->list $2) ,$3))
- ;; pointer => "*" pointer
- (lambda ($2 $1 . $rest) `(pointer ,$2))
- ;; type-qualifier-list => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; type-qualifier-list => type-qualifier-list type-qualifier
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; parameter-type-list => parameter-list
- (lambda ($1 . $rest) $1)
- ;; parameter-type-list => parameter-list "," "..."
- (lambda ($3 $2 $1 . $rest)
- (tl-append $1 '(ellipsis)))
- ;; parameter-list => parameter-declaration
- (lambda ($1 . $rest) (make-tl 'param-list $1))
- ;; parameter-list => parameter-list "," parameter-declaration
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; parameter-declaration => declaration-specifiers declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) (param-declr ,$2)))
- ;; parameter-declaration => declaration-specifiers abstract-declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) (param-declr ,$2)))
- ;; parameter-declaration => declaration-specifiers
- (lambda ($1 . $rest)
- `(param-decl ,(tl->list $1)))
- ;; identifier-list => identifier
- (lambda ($1 . $rest) (make-tl 'ident-list $1))
- ;; identifier-list => identifier-list "," identifier
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; type-name => specifier-qualifier-list abstract-declarator
- (lambda ($2 $1 . $rest)
- `(type-name ,(tl->list $1) ,$2))
- ;; type-name => declaration-specifiers
- (lambda ($1 . $rest) `(type-name ,(tl->list $1)))
- ;; abstract-declarator => pointer
- (lambda ($1 . $rest) `(abs-declr ,$1))
- ;; abstract-declarator => pointer direct-abstract-declarator
- (lambda ($2 $1 . $rest) `(abs-declr ,$1 ,$2))
- ;; abstract-declarator => direct-abstract-declarator
- (lambda ($1 . $rest) `(abs-declr ,$1))
- ;; direct-abstract-declarator => "(" abstract-declarator ")"
- (lambda ($3 $2 $1 . $rest) `(declr-scope ,$2))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-array ,$3 ,$4))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-array ,$1 ,$3))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" assignme...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-array ,$1 ,$3))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "]"
- (lambda ($3 $2 $1 . $rest) `(declr-array ,$1))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "static"...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))
- ,$5))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "static"...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$5))
- ;; direct-abstract-declarator => "[" type-qualifier-list assignment-expr...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-anon-array ,$2 ,$3))
- ;; direct-abstract-declarator => "[" type-qualifier-list "]"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-array ,$2))
- ;; direct-abstract-declarator => "[" assignment-expression "]"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-array ,$2))
- ;; direct-abstract-declarator => "[" "]"
- (lambda ($2 $1 . $rest) `(declr-anon-array))
- ;; direct-abstract-declarator => "[" "static" type-qualifier-list assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$4))
- ;; direct-abstract-declarator => "[" "static" type-qualifier-list "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $3))))
- ;; direct-abstract-declarator => "[" type-qualifier-list "static" assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $2))
- ,$4))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "*" "]"
- (lambda ($4 $3 $2 $1 . $rest) `(declr-STAR ,$1))
- ;; direct-abstract-declarator => "[" "*" "]"
- (lambda ($3 $2 $1 . $rest) '(declr-STAR))
- ;; direct-abstract-declarator => direct-abstract-declarator "(" paramete...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-fctn ,$1 ,(tl->list $3)))
- ;; direct-abstract-declarator => direct-abstract-declarator "(" ")"
- (lambda ($3 $2 $1 . $rest) `(declr-fctn ,$1))
- ;; direct-abstract-declarator => "(" parameter-type-list ")"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-fctn ,(tl->list $2)))
- ;; direct-abstract-declarator => "(" ")"
- (lambda ($2 $1 . $rest) '(declr-anon-fctn))
- ;; typedef-name => 'typename
- (lambda ($1 . $rest) `(typename ,$1))
- ;; initializer => assignment-expression
- (lambda ($1 . $rest) `(initzer ,$1))
- ;; initializer => "{" initializer-list "}"
- (lambda ($3 $2 $1 . $rest)
- `(initzer ,(tl->list $2)))
- ;; initializer => "{" initializer-list "," "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(initzer ,(tl->list $2)))
- ;; initializer-list => designation initializer
- (lambda ($2 $1 . $rest)
- (make-tl 'initzer-list $1 $2))
- ;; initializer-list => initializer
- (lambda ($1 . $rest) (make-tl 'initzer-list $1))
- ;; initializer-list => initializer-list "," designation initializer
- (lambda ($4 $3 $2 $1 . $rest)
- (tl-append $1 $3 $4))
- ;; initializer-list => initializer-list "," initializer
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; designation => designator-list "="
- (lambda ($2 $1 . $rest) `(desig ,$1))
- ;; designator-list => designator
- (lambda ($1 . $rest) (make-tl 'desgr-list $1))
- ;; designator-list => designator-list designator
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; designator => "[" constant-expression "]"
- (lambda ($3 $2 $1 . $rest) (list 'array-dsgr $2))
- ;; designator => "." identifier
- (lambda ($2 $1 . $rest) (list 'sel-dsgr $2))
- ;; statement => labeled-statement
- (lambda ($1 . $rest) $1)
- ;; statement => compound-statement
- (lambda ($1 . $rest) $1)
- ;; statement => expression-statement
- (lambda ($1 . $rest) $1)
- ;; statement => selection-statement
- (lambda ($1 . $rest) $1)
- ;; statement => iteration-statement
- (lambda ($1 . $rest) $1)
- ;; statement => jump-statement
- (lambda ($1 . $rest) $1)
- ;; statement => cpp-statement
- (lambda ($1 . $rest) $1)
- ;; labeled-statement => identifier ":" statement
- (lambda ($3 $2 $1 . $rest)
- `(labeled-stmt ,$1 ,$3))
- ;; labeled-statement => "case" constant-expression ":" statement
- (lambda ($4 $3 $2 $1 . $rest) `(case ,$2 ,$4))
- ;; labeled-statement => "default" ":" statement
- (lambda ($3 $2 $1 . $rest) `(default ,$3))
- ;; compound-statement => "{" block-item-list "}"
- (lambda ($3 $2 $1 . $rest)
- `(compd-stmt ,(tl->list $2)))
- ;; compound-statement => "{" "}"
- (lambda ($2 $1 . $rest)
- `(compd-stmt (block-item-list)))
- ;; block-item-list => block-item
- (lambda ($1 . $rest)
- (make-tl 'block-item-list $1))
- ;; block-item-list => block-item-list block-item
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; block-item => declaration
- (lambda ($1 . $rest) $1)
- ;; block-item => statement
- (lambda ($1 . $rest) $1)
- ;; expression-statement => expression ";"
- (lambda ($2 $1 . $rest) `(expr-stmt ,$1))
- ;; expression-statement => ";"
- (lambda ($1 . $rest) '(expr-stmt))
- ;; selection-statement => "if" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest) `(if ,$3 ,$5))
- ;; selection-statement => "if" "(" expression ")" statement "else" state...
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(if ,$3 ,$5 ,$7))
- ;; selection-statement => "switch" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(switch ,$3 ,$5))
- ;; iteration-statement => "while" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(while ,$3 ,$5))
- ;; iteration-statement => "do" statement "while" "(" expression ")" ";"
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(do-while ,$2 ,$5))
- ;; iteration-statement => "for" "(" initial-clause opt-expression ";" op...
- (lambda ($8 $7 $6 $5 $4 $3 $2 $1 . $rest)
- `(for ,$3 ,$4 ,$6 ,$8))
- ;; initial-clause => expression ";"
- (lambda ($2 $1 . $rest) $1)
- ;; initial-clause => ";"
- (lambda ($1 . $rest) '(expr))
- ;; initial-clause => declaration
- (lambda ($1 . $rest) $1)
- ;; opt-expression =>
- (lambda $rest '(expr))
- ;; opt-expression => expression
- (lambda ($1 . $rest) $1)
- ;; jump-statement => "goto" identifier ";"
- (lambda ($3 $2 $1 . $rest) `(goto ,$2))
- ;; jump-statement => "continue" ";"
- (lambda ($2 $1 . $rest) '(continue))
- ;; jump-statement => "break" ";"
- (lambda ($2 $1 . $rest) '(break))
- ;; jump-statement => "return" expression ";"
- (lambda ($3 $2 $1 . $rest) `(return ,$2))
- ;; jump-statement => "return" ";"
- (lambda ($2 $1 . $rest) `(return (expr)))
- ;; translation-unit => external-declaration-list
- (lambda ($1 . $rest) (tl->list $1))
- ;; external-declaration-list =>
- (lambda $rest (make-tl 'trans-unit))
- ;; external-declaration-list => external-declaration-list external-decla...
- (lambda ($2 $1 . $rest)
- (if (eqv? (sx-tag $2) 'extern-block)
- (tl-extend $1 (sx-tail $2 1))
- (tl-append $1 $2)))
- ;; external-declaration => function-definition
- (lambda ($1 . $rest) $1)
- ;; external-declaration => declaration
- (lambda ($1 . $rest) $1)
- ;; external-declaration => lone-comment
- (lambda ($1 . $rest) $1)
- ;; external-declaration => cpp-statement
- (lambda ($1 . $rest) $1)
- ;; external-declaration => pragma
- (lambda ($1 . $rest) $1)
- ;; external-declaration => "extern" '$string "{" external-declaration-li...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(extern-block
- (extern-begin ,$2)
- ,@(sx-tail (tl->list $4) 1)
- (extern-end)))
- ;; external-declaration => ";"
- (lambda ($1 . $rest)
- `(decl (@ (extension . "GNU C"))))
- ;; function-definition => declaration-specifiers declarator declaration-...
- (lambda ($4 $3 $2 $1 . $rest)
- `(knr-fctn-defn
- ,(tl->list $1)
- ,$2
- ,(tl->list $3)
- ,$4))
- ;; function-definition => declaration-specifiers declarator compound-sta...
- (lambda ($3 $2 $1 . $rest)
- `(fctn-defn ,(tl->list $1) ,$2 ,$3))
- ;; declaration-list => declaration
- (lambda ($1 . $rest) (make-tl $1))
- ;; declaration-list => declaration-list declaration
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; opt-code-comment =>
- (lambda $rest (list))
- ;; opt-code-comment => code-comment
- (lambda ($1 . $rest) $1)
- ;; identifier => '$ident
- (lambda ($1 . $rest) `(ident ,$1))
- ;; identifier => 'cpp-ident
- (lambda ($1 . $rest) `(ident ,$1))
- ;; constant => '$fixed
- (lambda ($1 . $rest) `(fixed ,$1))
- ;; constant => '$float
- (lambda ($1 . $rest) `(float ,$1))
- ;; constant => '$chlit
- (lambda ($1 . $rest) `(char ,$1))
- ;; string-literal => '$string
- (lambda ($1 . $rest) (make-tl 'string $1))
- ;; string-literal => string-literal '$string
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; code-comment => '$code-comm
- (lambda ($1 . $rest) `(comment ,$1))
- ;; lone-comment => '$lone-comm
- (lambda ($1 . $rest) `(comment ,$1))
- ;; cpp-statement => 'cpp-stmt
- (lambda ($1 . $rest) `(cpp-stmt ,$1))
- ;; pragma => 'cpp-pragma
- (lambda ($1 . $rest) $1)
- ))
-
-;;; end tables
+++ /dev/null
-;; ./mach.d/c99tab.scm
-
-;; Copyright (C) 2016,2017 Matthew R. Wette
-;;
-;; This software is covered by the GNU GENERAL PUBLIC LICENCE, Version 3,
-;; or any later version published by the Free Software Foundation. See
-;; the file COPYING included with the this distribution.
-
-(define c99-len-v
- #(1 1 1 1 3 1 4 4 3 3 3 2 2 6 7 1 3 1 3 2 1 1 2 2 2 2 4 1 1 1 1 1 1 1 4 1
- 3 3 3 1 3 3 1 3 3 1 3 3 3 3 1 3 3 1 3 1 3 1 3 1 3 1 3 1 5 1 3 1 1 1 1 1 1
- 1 1 1 1 1 1 3 1 5 3 0 1 2 1 2 1 2 1 2 1 3 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1
- 2 2 3 1 1 2 1 2 2 3 2 3 3 4 3 2 2 1 3 2 4 3 1 2 2 1 1 2 1 2 2 3 5 4 2 5 4
- 2 1 1 1 1 2 2 4 2 1 2 1 1 3 1 3 2 5 6 4 5 2 1 3 1 3 1 1 1 1 2 1 1 3 5 4 4
- 3 6 6 5 4 4 4 3 2 1 3 2 1 2 1 3 1 3 2 2 1 1 3 2 1 1 2 1 3 5 4 4 3 6 5 6 4
- 3 3 2 5 4 5 4 3 4 3 3 2 1 1 3 4 2 1 4 3 2 1 2 3 2 1 1 1 1 1 1 1 3 4 3 3 2
- 1 2 1 1 2 1 5 7 5 5 7 8 2 1 1 0 1 3 2 2 3 2 1 0 2 1 1 1 1 1 5 1 4 3 1 2 0
- 1 1 1 1 1 1 1 2 1 1 1 1))
-
-(define c99-pat-v
- #(((103 . 1) (182 . 2) (97 . -281) (95 . -281) (-1 . -281)) ((22 . 3) (28
- . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36
- . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19
- ) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 .
- 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (47 . 31) (147 . 32) (148 . 33
- ) (149 . 34) (150 . 35) (1 . 36) (2 . 37) (95 . 38) (170 . 39) (48 . 40) (
- 46 . 41) (100 . 42) (110 . 43) (134 . 44) (106 . 45) (101 . 46) (102 . 47)
- (97 . -280)) ((97 . 0)) ((-1 . -233)) ((85 . 85) (6 . 52) (7 . 53) (22 .
- 3) (138 . 80) (181 . 81) (137 . 86)) ((85 . 83) (6 . 52) (7 . 53) (22 . 3)
- (138 . 80) (181 . 81) (137 . 84)) ((85 . 79) (6 . 52) (7 . 53) (22 . 3) (
- 138 . 80) (181 . 81) (137 . 82)) ((-1 . -138)) ((31 . 78) (-1 . -136)) ((
- 31 . 77) (-1 . -135)) ((-1 . -132)) ((40 . 73) (38 . 74) (36 . 75) (34 .
- 76) (-1 . -127)) ((38 . 70) (36 . 71) (32 . 72) (-1 . -116)) ((-1 . -113))
- ((40 . 66) (38 . 67) (36 . 68) (34 . 69) (-1 . -114)) ((38 . 65) (-1 .
- -109)) ((-1 . -176)) ((-1 . -175)) ((-1 . -174)) ((-1 . -173)) ((-1 . -108
- )) ((-1 . -107)) ((-1 . -106)) ((-1 . -105)) ((-1 . -104)) ((-1 . -103)) (
- (-1 . -102)) ((-1 . -101)) ((-1 . -100)) ((-1 . -99)) ((-1 . -98)) ((-1 .
- -96)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34
- . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17
- ) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24
- ) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60)
- (47 . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 64) (-1 . -90
- )) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 .
- 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17)
- (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24)
- (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (
- 47 . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 63) (-1 . -88)
- ) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10
- ) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17) (
- 26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (
- 142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47
- . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 62) (-1 . -86))
- ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10)
- (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17) (26
- . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142
- . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 .
- 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 61) (-1 . -84)) ((
- 95 . -306) (97 . -306) (-1 . -306)) ((95 . -305) (97 . -305) (-1 . -305))
- ((95 . -304) (97 . -304) (-1 . -304)) ((146 . 49) (153 . 50) (48 . 51) (6
- . 52) (7 . 53) (80 . 54) (93 . 55) (181 . 56) (126 . 57) (127 . 58) (145
- . 59)) ((95 . -289) (97 . -289) (-1 . -289)) ((8 . 48) (-1 . -97)) ((95 .
- -287) (97 . -287) (-1 . -287)) ((95 . -286) (97 . -286) (-1 . -286)) ((95
- . -285) (97 . -285) (-1 . -285)) ((95 . -284) (97 . -284) (-1 . -284)) ((
- 95 . -283) (97 . -283) (-1 . -283)) ((95 . -282) (97 . -282) (-1 . -282))
- ((85 . 126)) ((48 . -92) (83 . -92)) ((152 . 124) (83 . 125) (48 . -83)) (
- (94 . 121) (98 . 122) (151 . 123) (97 . -294) (95 . -294) (-1 . -294)) ((
- -1 . -297)) ((-1 . -296)) ((25 . 17) (26 . 18) (27 . 19) (148 . 118) (125
- . 119) (80 . 54) (127 . 120) (-1 . -193)) ((6 . 52) (7 . 53) (80 . 54) (93
- . 55) (181 . 56) (126 . 57) (127 . 58) (145 . 117)) ((-1 . -179)) ((91 .
- 115) (93 . 116) (-1 . -178)) ((6 . 52) (7 . 53) (93 . 55) (181 . 56) (126
- . 114)) ((85 . 108) (115 . 109) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 .
- 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40
- . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140
- . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44
- . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 33) (149 . 34) (150
- . 35) (170 . 110) (106 . 111) (99 . 112) (59 . 113) (48 . -94) (83 . -94))
- ((-1 . -97)) ((-1 . -85)) ((-1 . -87)) ((-1 . -89)) ((-1 . -91)) ((-1 .
- -110)) ((38 . 107) (-1 . -111)) ((-1 . -115)) ((36 . 105) (38 . 106) (-1
- . -118)) ((-1 . -133)) ((-1 . -117)) ((38 . 104) (-1 . -120)) ((31 . 103)
- (-1 . -137)) ((38 . 102) (-1 . -125)) ((-1 . -126)) ((36 . 100) (38 . 101)
- (-1 . -129)) ((-1 . -134)) ((-1 . -139)) ((-1 . -140)) ((22 . 3) (28 . 4)
- (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12
- ) (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (
- 139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27)
- (148 . 92) (149 . 93) (95 . 38) (133 . 94) (134 . 95) (135 . 96) (136 . 99
- )) ((-1 . -149)) ((-1 . -148)) ((85 . 98) (-1 . -144)) ((22 . 3) (28 . 4)
- (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12)
- (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (
- 139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27)
- (148 . 92) (149 . 93) (95 . 38) (133 . 94) (134 . 95) (135 . 96) (136 . 97
- )) ((85 . 91) (-1 . -147)) ((6 . 52) (7 . 53) (181 . 88) (128 . 89) (129
- . 90)) ((85 . 87) (-1 . -168)) ((6 . 52) (7 . 53) (181 . 88) (128 . 89) (
- 129 . 228)) ((59 . 227) (84 . -171) (83 . -171)) ((84 . -169) (83 . -169))
- ((84 . 225) (83 . 226)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32
- . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15)
- (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23)
- (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148 . 92) (149 . 93) (95 . 38)
- (133 . 94) (134 . 95) (135 . 96) (136 . 224)) ((22 . 3) (28 . 4) (29 . 5)
- (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 .
- 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21
- ) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148 .
- 92) (149 . 93) (133 . 223) (-1 . -158)) ((22 . 3) (28 . 4) (29 . 5) (30 .
- 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37
- . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140
- . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148 . 92) (149
- . 93) (133 . 222) (-1 . -156)) ((6 . 52) (7 . 53) (80 . 54) (93 . 55) (
- 181 . 56) (126 . 57) (127 . 58) (60 . 218) (145 . 219) (131 . 220) (132 .
- 221)) ((95 . -151) (-1 . -151)) ((95 . -150) (-1 . -150)) ((84 . 217) (22
- . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35
- . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19
- ) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 .
- 26) (42 . 27) (148 . 92) (149 . 93) (133 . 94) (135 . 214) (95 . 38) (134
- . 215)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (
- 34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26
- . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142
- . 25) (143 . 26) (42 . 27) (148 . 92) (149 . 93) (95 . 38) (133 . 94) (
- 134 . 95) (135 . 96) (136 . 216)) ((84 . 213) (22 . 3) (28 . 4) (29 . 5) (
- 30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13)
- (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (
- 140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148 . 92)
- (149 . 93) (133 . 94) (135 . 214) (95 . 38) (134 . 215)) ((38 . 212) (-1
- . -131)) ((-1 . -128)) ((-1 . -124)) ((-1 . -141)) ((-1 . -121)) ((38 .
- 211) (-1 . -122)) ((-1 . -119)) ((-1 . -112)) ((166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 .
- 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (
- 168 . 174) (155 . 175) (6 . 52) (7 . 53) (24 . 16) (25 . 17) (26 . 18) (27
- . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (
- 143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (172
- . 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14
- . 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108)
- (20 . 196) (21 . 197) (181 . 198) (147 . 32) (148 . 33) (149 . 34) (150
- . 35) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114 . 203) (115 .
- 204) (116 . 205) (170 . 110) (109 . 206) (106 . 207) (107 . 208) (108 .
- 209) (84 . 210)) ((95 . -291) (97 . -291) (-1 . -291)) ((6 . 52) (7 . 53)
- (80 . 54) (93 . 55) (181 . 56) (126 . 57) (127 . 58) (145 . 128) (146 . 49
- ) (153 . 50) (48 . 51)) ((-1 . -292)) ((85 . 108) (115 . 182) (22 . 3) (28
- . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36
- . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 .
- 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143
- . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 .
- 32) (148 . 33) (149 . 34) (150 . 35) (170 . 110) (106 . 183)) ((166 . 143)
- (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (
- 8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158
- . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 .
- 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168
- . 174) (155 . 175) (85 . 179) (172 . 180) (144 . 181)) ((91 . 115) (93 .
- 116) (-1 . -177)) ((44 . 141) (90 . 142) (166 . 143) (165 . 144) (164 .
- 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (
- 4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 .
- 163) (80 . 164) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (
- 167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172
- . 176) (25 . 17) (26 . 18) (27 . 19) (148 . 118) (125 . 177)) ((92 . 134)
- (6 . 52) (7 . 53) (181 . 135) (123 . 136) (22 . 3) (28 . 4) (29 . 5) (30
- . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (
- 37 . 14) (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139
- . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43
- . 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 33) (149
- . 34) (150 . 35) (170 . 137) (121 . 138) (122 . 139) (124 . 140)) ((92 .
- 133)) ((-1 . -196)) ((80 . 54) (127 . 131) (25 . 17) (26 . 18) (27 . 19) (
- 148 . 132) (-1 . -192)) ((-1 . -195)) ((95 . -303) (97 . -303) (-1 . -303)
- ) ((95 . -295) (97 . -295) (-1 . -295)) ((95 . -82) (97 . -82) (-1 . -82))
- ((48 . 130)) ((6 . 52) (7 . 53) (80 . 54) (93 . 55) (181 . 56) (126 . 57)
- (127 . 58) (145 . 128) (146 . 129)) ((103 . 127) (95 . -281) (-1 . -281))
- ((84 . 334) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9
- ) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (
- 25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (
- 41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (47
- . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (1 . 36) (2 . 37) (95
- . 38) (170 . 39) (48 . 40) (46 . 41) (100 . 42) (110 . 43) (134 . 44) (106
- . 45) (101 . 46) (102 . 47)) ((59 . 113) (48 . -94) (83 . -94)) ((48 .
- -93) (83 . -93)) ((94 . 121) (98 . 122) (151 . 333) (97 . -294) (95 . -294
- ) (-1 . -294)) ((-1 . -194)) ((-1 . -197)) ((-1 . -180)) ((-1 . -191)) ((
- 92 . -205) (83 . -205)) ((92 . 331) (83 . 332)) ((6 . 52) (7 . 53) (181 .
- 56) (126 . 57) (145 . 325) (91 . 326) (93 . 327) (80 . 54) (120 . 328) (
- 127 . 329) (169 . 330) (92 . -204) (83 . -204)) ((83 . -200) (92 . -200))
- ((83 . 324) (92 . -198)) ((92 . 323)) ((25 . 17) (26 . 18) (27 . 19) (148
- . 118) (125 . 322)) ((-1 . -184)) ((-1 . -35)) ((80 . 319) (75 . 320) (74
- . 321) (-1 . -39)) ((79 . 317) (78 . 318) (-1 . -42)) ((73 . 315) (72 .
- 316) (-1 . -45)) ((71 . 311) (70 . 312) (69 . 313) (68 . 314) (-1 . -50))
- ((67 . 309) (66 . 310) (-1 . -53)) ((81 . 308) (-1 . -55)) ((-1 . -301)) (
- (-1 . -300)) ((-1 . -299)) ((-1 . -298)) ((65 . 307) (-1 . -57)) ((64 .
- 306) (-1 . -59)) ((8 . 305) (-1 . -3)) ((-1 . -2)) ((-1 . -1)) ((63 . 304)
- (-1 . -61)) ((-1 . -32)) ((-1 . -31)) ((-1 . -30)) ((-1 . -29)) ((90 .
- 303) (-1 . -28)) ((-1 . -27)) ((166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5
- . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 184) (178
- . 297) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34
- . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 .
- 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 .
- 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60
- ) (47 . 31) (147 . 32) (148 . 298) (149 . 299) (150 . 35) (170 . 300) (133
- . 301) (174 . 302)) ((-1 . -5)) ((61 . 295) (62 . 296) (-1 . -63)) ((8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 .
- 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (
- 81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 .
- 173) (168 . 293) (93 . 294)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6
- . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (
- 78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 .
- 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 292))
- ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (
- 180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 289) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (
- 87 . 172) (176 . 173) (168 . 291)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153
- ) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 .
- 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 289) (177 . 167) (
- 82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 290)) ((91
- . 283) (93 . 284) (89 . 285) (88 . 286) (87 . 287) (86 . 288) (-1 . -21))
- ((49 . 271) (50 . 272) (51 . 273) (52 . 274) (53 . 275) (54 . 276) (55 .
- 277) (56 . 278) (57 . 279) (58 . 280) (59 . 281) (154 . 282) (-1 . -33)) (
- (-1 . -65)) ((90 . 270)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146)
- (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153
- ) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181
- . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (81 . 165)
- (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87
- . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 266) (25 . 17) (26 . 18)
- (27 . 19) (148 . 132) (90 . 267) (44 . 268) (80 . 269)) ((-1 . -28)) ((
- 166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (
- 160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (89 . 259) (91 . 260) (156 . 168) (82 . 169) (167 . 170) (86 .
- 171) (87 . 172) (176 . 173) (117 . 261) (168 . 174) (155 . 175) (118 . 262
- ) (85 . 179) (172 . 180) (144 . 263) (119 . 264) (173 . 265)) ((83 . -234)
- (84 . -234) (48 . -234)) ((48 . -95) (83 . -95)) ((95 . -290) (97 . -290)
- (-1 . -290)) ((-1 . -293)) ((-1 . -78)) ((166 . 143) (165 . 144) (164 .
- 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (
- 4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 .
- 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (
- 167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172
- . 184) (178 . 257) (48 . 258)) ((48 . 256)) ((48 . 255)) ((6 . 52) (7 . 53
- ) (181 . 254)) ((93 . 253)) ((166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5
- . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 . 184) (2 . 37) (9
- . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 . 190) (15 . 191) (
- 16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (20 . 196) (21 .
- 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114 .
- 203) (115 . 204) (116 . 205) (109 . 252)) ((93 . 251)) ((93 . 250)) ((93
- . 249)) ((-1 . -263)) ((48 . 247) (83 . 248)) ((60 . 246)) ((8 . 150) (3
- . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181
- . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 .
- 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 .
- 147) (161 . 148) (160 . 149) (159 . 154) (158 . 155) (157 . 159) (156 .
- 168) (155 . 232) (130 . 245)) ((60 . 244) (-1 . -1)) ((-1 . -252)) ((-1 .
- -251)) ((-1 . -250)) ((-1 . -249)) ((-1 . -248)) ((-1 . -247)) ((-1 . -246
- )) ((-1 . -261)) ((-1 . -260)) ((-1 . -258)) ((84 . 242) (166 . 143) (165
- . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31
- . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (
- 40 . 15) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (24 . 16) (25 . 17) (26
- . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (
- 142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47
- . 31) (172 . 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13
- . 189) (14 . 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195)
- (85 . 108) (20 . 196) (21 . 197) (181 . 198) (147 . 32) (148 . 33) (149
- . 34) (150 . 35) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114 .
- 203) (115 . 204) (116 . 205) (170 . 110) (109 . 206) (106 . 207) (107 .
- 243)) ((95 . -257) (97 . -257) (-1 . -257)) ((-1 . -123)) ((-1 . -130)) ((
- -1 . -143)) ((95 . -152) (-1 . -152)) ((95 . -153) (-1 . -153)) ((84 . 241
- ) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10)
- (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27
- . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (
- 143 . 26) (42 . 27) (148 . 92) (149 . 93) (133 . 94) (135 . 214) (95 . 38)
- (134 . 215)) ((-1 . -146)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 .
- 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (78
- . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170
- ) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 143) (
- 165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (
- 159 . 154) (158 . 155) (157 . 159) (156 . 168) (155 . 232) (130 . 240)) ((
- 60 . 239) (48 . -161) (83 . -161)) ((48 . -159) (83 . -159)) ((48 . 237) (
- 83 . 238)) ((-1 . -155)) ((-1 . -157)) ((84 . 236) (22 . 3) (28 . 4) (29
- . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38
- . 13) (37 . 14) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139
- . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148
- . 92) (149 . 93) (133 . 94) (135 . 214) (95 . 38) (134 . 215)) ((-1 .
- -166)) ((84 . 234) (6 . 52) (7 . 53) (181 . 88) (128 . 235)) ((8 . 150) (3
- . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181
- . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165)
- (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93
- . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 .
- 147) (161 . 148) (160 . 149) (159 . 154) (158 . 155) (157 . 159) (156 .
- 168) (155 . 232) (130 . 233)) ((83 . 229) (84 . 230)) ((6 . 52) (7 . 53) (
- 181 . 88) (128 . 235) (84 . 412)) ((-1 . -164)) ((-1 . -33)) ((-1 . -80))
- ((84 . -172) (83 . -172)) ((-1 . -167)) ((84 . -170) (83 . -170)) ((-1 .
- -145)) ((94 . 121) (98 . 122) (151 . 411) (95 . -294) (-1 . -294)) ((6 .
- 52) (7 . 53) (80 . 54) (93 . 55) (181 . 56) (126 . 57) (127 . 58) (60 .
- 218) (145 . 219) (131 . 410)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6
- . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (
- 78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 .
- 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 143)
- (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (
- 159 . 154) (158 . 155) (157 . 159) (156 . 168) (155 . 232) (130 . 409)) ((
- 48 . -163) (83 . -163)) ((-1 . -142)) ((95 . -256) (97 . -256) (-1 . -256)
- ) ((-1 . -259)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 .
- 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (157 . 159) (76 . 160) (77 .
- 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168
- . 174) (155 . 175) (6 . 52) (7 . 53) (172 . 184) (2 . 37) (9 . 185) (10 .
- 186) (11 . 187) (12 . 188) (13 . 189) (14 . 190) (15 . 191) (16 . 192) (19
- . 193) (48 . 194) (178 . 195) (85 . 108) (20 . 196) (21 . 197) (181 . 198
- ) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114 . 203) (115 . 204)
- (116 . 205) (109 . 408)) ((60 . 407)) ((166 . 143) (165 . 144) (164 . 145)
- (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 .
- 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (157 . 159)
- (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 .
- 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172)
- (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 . 184) (2 . 37)
- (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 . 190) (15 .
- 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (20 . 196) (
- 21 . 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114
- . 203) (115 . 204) (116 . 205) (109 . 406)) ((-1 . -262)) ((166 . 143) (
- 165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8
- . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 .
- 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161)
- (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156
- . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174
- ) (155 . 175) (172 . 405)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146
- ) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 .
- 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 184) (178
- . 404)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161
- . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 .
- 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159
- ) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 .
- 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172)
- (176 . 173) (168 . 174) (155 . 175) (172 . 184) (178 . 403)) ((166 . 143)
- (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8
- . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158
- . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 .
- 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168
- . 174) (155 . 175) (172 . 184) (178 . 402)) ((15 . 401)) ((166 . 143) (165
- . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 .
- 155) (179 . 156) (180 . 157) (181 . 158) (22 . 3) (28 . 4) (29 . 5) (30 .
- 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37
- . 14) (40 . 15) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (
- 80 . 178) (81 . 165) (93 . 166) (177 . 167) (24 . 16) (25 . 17) (26 . 18)
- (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25)
- (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (147
- . 32) (148 . 33) (149 . 34) (150 . 35) (168 . 174) (155 . 175) (170 . 110)
- (172 . 184) (106 . 397) (48 . 398) (178 . 399) (105 . 400)) ((48 . 396))
- ((-1 . -276)) ((-1 . -277)) ((48 . 395) (83 . 248)) ((-1 . -279)) ((6 . 52
- ) (7 . 53) (181 . 394)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52)
- (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 .
- 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170) (
- 86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 143) (165
- . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (159 .
- 154) (158 . 155) (157 . 159) (156 . 168) (155 . 232) (130 . 393)) ((59 .
- -242) (89 . -242) (91 . -242)) ((59 . 391) (89 . 259) (91 . 260) (117 .
- 392)) ((83 . -238) (84 . -238)) ((166 . 143) (165 . 144) (164 . 145) (163
- . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (
- 5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157)
- (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80
- . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170
- ) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (85 . 179) (
- 172 . 180) (144 . 390)) ((83 . 388) (84 . 389)) ((90 . 387)) ((-1 . -182))
- ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148)
- (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (172 . 386)) ((90 . 385) (-1 . -28)) ((-1
- . -183)) ((-1 . -77)) ((-1 . -76)) ((-1 . -75)) ((-1 . -74)) ((-1 . -73))
- ((-1 . -72)) ((-1 . -71)) ((-1 . -70)) ((-1 . -69)) ((-1 . -68)) ((-1 .
- -67)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 .
- 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53)
- (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (
- 76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166
- ) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (
- 176 . 173) (168 . 174) (155 . 175) (172 . 384)) ((166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 .
- 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162)
- (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175)
- (172 . 184) (178 . 383)) ((92 . 378) (166 . 143) (165 . 144) (164 . 145)
- (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 .
- 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (22 . 3) (28 . 4) (29 . 5) (
- 30 . 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13)
- (37 . 14) (40 . 15) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (24
- . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141
- . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 .
- 30) (46 . 60) (47 . 31) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79
- . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (147 . 32) (148 . 33)
- (149 . 34) (150 . 35) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 .
- 172) (176 . 173) (168 . 174) (155 . 175) (170 . 379) (171 . 380) (172 .
- 381) (175 . 382)) ((6 . 52) (7 . 53) (181 . 377)) ((6 . 52) (7 . 53) (181
- . 376)) ((-1 . -11)) ((-1 . -12)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31
- . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14)
- (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (
- 140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (
- 44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 298) (149 . 299)
- (150 . 35) (170 . 300) (133 . 301) (174 . 375) (166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 .
- 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162)
- (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175)
- (172 . 184) (178 . 297)) ((-1 . -22)) ((-1 . -23)) ((-1 . -24)) ((-1 .
- -25)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34
- . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17
- ) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24
- ) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60)
- (47 . 31) (147 . 32) (148 . 298) (149 . 299) (150 . 35) (170 . 300) (133
- . 301) (174 . 374) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 .
- 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 .
- 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (
- 157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 184) (178 . 297)) ((
- 166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (
- 160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (172 . 184) (178 . 373)) ((8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 .
- 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 .
- 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 .
- 147) (161 . 148) (160 . 149) (159 . 154) (158 . 155) (157 . 372)) ((92 .
- 371) (83 . 248)) ((24 . 16) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 .
- 31) (147 . 32) (150 . 35) (170 . 63) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (
- 31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14
- ) (40 . 15) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22)
- (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (148 . 298) (149 .
- 299) (133 . 223) (92 . -88) (80 . -158) (91 . -158) (93 . -158)) ((24 . 16
- ) (43 . 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (150 . 35)
- (170 . 62) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9)
- (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (25 . 17) (26
- . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24) (142
- . 25) (143 . 26) (42 . 27) (148 . 298) (149 . 299) (133 . 222) (92 . -86)
- (80 . -156) (91 . -156) (93 . -156)) ((92 . -208)) ((91 . 326) (93 . 368)
- (80 . 54) (120 . 328) (127 . 369) (169 . 370)) ((92 . 367)) ((-1 . -188))
- ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (
- 180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (
- 176 . 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163
- . 146) (162 . 147) (161 . 148) (160 . 149) (159 . 154) (158 . 366)) ((-1
- . -302)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179
- . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163)
- (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87
- . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 .
- 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (159 . 365)) ((8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 .
- 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (
- 81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 .
- 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 146
- ) (162 . 147) (161 . 148) (160 . 364)) ((8 . 150) (3 . 151) (4 . 152) (5
- . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (
- 77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231)
- (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 363)) (
- (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180
- . 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178)
- (81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 362)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 .
- 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (
- 79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 .
- 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144)
- (164 . 145) (163 . 146) (162 . 361)) ((8 . 150) (3 . 151) (4 . 152) (5 .
- 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77
- . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169)
- (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166
- . 143) (165 . 144) (164 . 145) (163 . 360)) ((8 . 150) (3 . 151) (4 . 152)
- (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160
- ) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82
- . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231
- ) (166 . 143) (165 . 144) (164 . 145) (163 . 359)) ((8 . 150) (3 . 151) (4
- . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (
- 76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 .
- 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (
- 168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 358)) ((8 . 150) (3
- . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181
- . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 .
- 166) (168 . 231) (166 . 143) (165 . 144) (164 . 145) (163 . 357)) ((8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 .
- 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (
- 81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 .
- 173) (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 356)) ((8 . 150
- ) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157)
- (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173)
- (93 . 166) (168 . 231) (166 . 143) (165 . 144) (164 . 355)) ((8 . 150) (3
- . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181
- . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 .
- 166) (168 . 231) (166 . 143) (165 . 354)) ((8 . 150) (3 . 151) (4 . 152) (
- 5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160)
- (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231)
- (166 . 143) (165 . 353)) ((8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52)
- (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (77 . 161) (78 .
- 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 . 169) (167 . 170) (
- 86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231) (166 . 352)) ((8
- . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 .
- 157) (181 . 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (
- 81 . 165) (177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 .
- 173) (93 . 166) (168 . 231) (166 . 351)) ((8 . 150) (3 . 151) (4 . 152) (5
- . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160) (
- 77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231)
- (166 . 350)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147)
- (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (
- 7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157
- . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 .
- 172) (176 . 173) (168 . 174) (155 . 175) (172 . 349) (25 . 17) (26 . 18) (
- 27 . 19) (148 . 132)) ((-1 . -189)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (
- 31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14
- ) (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21)
- (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28)
- (44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 33) (149 . 34) (
- 150 . 35) (170 . 137) (121 . 347) (23 . 348)) ((92 . -202) (83 . -202)) ((
- 166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (
- 160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (81 . 165) (93 . 166) (177 . 167) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168
- . 174) (155 . 175) (172 . 342) (90 . 343) (44 . 344) (25 . 17) (26 . 18) (
- 27 . 19) (148 . 118) (125 . 345) (80 . 346)) ((91 . 326) (120 . 328) (169
- . 339) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9) (34
- . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25 . 17
- ) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41 . 24
- ) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46 . 60)
- (47 . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 137) (121 .
- 138) (122 . 139) (124 . 340) (92 . 341) (6 . 52) (7 . 53) (80 . 54) (93 .
- 327) (181 . 56) (126 . 57) (127 . 329) (145 . 117)) ((91 . 337) (93 . 338)
- (92 . -211) (83 . -211)) ((91 . 326) (120 . 336) (6 . 52) (7 . 53) (93 .
- 327) (181 . 56) (126 . 114) (92 . -209) (83 . -209)) ((92 . -203) (83 .
- -203)) ((-1 . -190)) ((6 . 52) (7 . 53) (181 . 335)) ((95 . -81) (97 . -81
- ) (-1 . -81)) ((95 . -288) (97 . -288) (-1 . -288)) ((92 . -206) (83 .
- -206)) ((91 . 337) (93 . 338) (92 . -210) (83 . -210)) ((44 . 446) (90 .
- 447) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 .
- 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53)
- (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (
- 76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 448) (81 . 165) (93 . 166
- ) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (
- 176 . 173) (168 . 174) (155 . 175) (172 . 449) (25 . 17) (26 . 18) (27 .
- 19) (148 . 118) (125 . 450)) ((92 . 444) (22 . 3) (28 . 4) (29 . 5) (30 .
- 6) (31 . 7) (32 . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37
- . 14) (40 . 15) (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 .
- 21) (140 . 22) (141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 .
- 28) (44 . 29) (45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 33) (149 .
- 34) (150 . 35) (170 . 137) (121 . 138) (122 . 139) (124 . 445)) ((92 . 443
- )) ((92 . 442)) ((-1 . -232)) ((90 . 441)) ((-1 . -223)) ((25 . 17) (26 .
- 18) (27 . 19) (148 . 118) (125 . 440)) ((44 . 437) (25 . 17) (26 . 18) (27
- . 19) (148 . 132) (90 . 438) (166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5
- . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 439)) ((
- 90 . 436) (-1 . -28)) ((83 . -201) (92 . -201)) ((92 . -199)) ((90 . 435))
- ((-1 . -38)) ((-1 . -37)) ((-1 . -36)) ((80 . 319) (75 . 320) (74 . 321)
- (-1 . -41)) ((80 . 319) (75 . 320) (74 . 321) (-1 . -40)) ((79 . 317) (78
- . 318) (-1 . -44)) ((79 . 317) (78 . 318) (-1 . -43)) ((73 . 315) (72 .
- 316) (-1 . -49)) ((73 . 315) (72 . 316) (-1 . -48)) ((73 . 315) (72 . 316)
- (-1 . -47)) ((73 . 315) (72 . 316) (-1 . -46)) ((71 . 311) (70 . 312) (69
- . 313) (68 . 314) (-1 . -52)) ((71 . 311) (70 . 312) (69 . 313) (68 . 314
- ) (-1 . -51)) ((67 . 309) (66 . 310) (-1 . -54)) ((81 . 308) (-1 . -56)) (
- (65 . 307) (-1 . -58)) ((64 . 306) (-1 . -60)) ((85 . 433) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 .
- 158) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (
- 177 . 167) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 .
- 166) (168 . 231) (166 . 434)) ((91 . 326) (93 . 368) (80 . 54) (120 . 328)
- (127 . 369) (169 . 339) (22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32
- . 8) (33 . 9) (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15)
- (24 . 16) (25 . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (
- 141 . 23) (41 . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (
- 45 . 30) (46 . 60) (47 . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (
- 170 . 137) (121 . 138) (122 . 139) (124 . 340) (92 . 341)) ((91 . 326) (93
- . 368) (120 . 336) (92 . -209) (83 . -209)) ((92 . -207)) ((-1 . -4)) ((
- 63 . 304) (-1 . -62)) ((60 . 432) (83 . 248)) ((92 . 431)) ((92 . 430)) ((
- -1 . -10)) ((-1 . -9)) ((-1 . -8)) ((91 . 326) (93 . 368) (80 . 54) (120
- . 328) (127 . 369) (169 . 429) (92 . -20) (83 . -20)) ((92 . -17) (83 .
- -17)) ((92 . -15) (83 . -15)) ((92 . 427) (83 . 428)) ((90 . 426) (83 .
- 248)) ((-1 . -66)) ((-1 . -187)) ((90 . 425)) ((-1 . -181)) ((166 . 143) (
- 165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8
- . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 .
- 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161)
- (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156
- . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174
- ) (155 . 175) (85 . 179) (172 . 180) (144 . 422) (89 . 259) (91 . 260) (
- 117 . 261) (118 . 262) (119 . 423) (84 . 424)) ((83 . -235) (84 . -235) (
- 48 . -235)) ((83 . -237) (84 . -237)) ((-1 . -241)) ((59 . -243) (89 .
- -243) (91 . -243)) ((90 . 421)) ((59 . -245) (91 . -245) (89 . -245)) ((-1
- . -278)) ((-1 . -275)) ((-1 . -272)) ((-1 . -271)) ((48 . 420) (83 . 248)
- ) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148)
- (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (
- 159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76
- . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166)
- (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (172 . 184) (178 . 418) (104 . 419) (48 .
- -273)) ((93 . 417)) ((92 . 416) (83 . 248)) ((92 . 415) (83 . 248)) ((83
- . 248) (92 . 414)) ((-1 . -79)) ((-1 . -255)) ((166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 .
- 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 .
- 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (
- 20 . 196) (21 . 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113
- . 202) (114 . 203) (115 . 204) (116 . 205) (109 . 413)) ((-1 . -253)) ((48
- . -162) (83 . -162)) ((48 . -160) (83 . -160)) ((95 . -154) (-1 . -154))
- ((-1 . -165)) ((-1 . -254)) ((166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5
- . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 . 184) (2 . 37) (9
- . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 . 190) (15 . 191) (
- 16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (20 . 196) (21 .
- 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (114 .
- 203) (115 . 204) (116 . 205) (109 . 471)) ((166 . 143) (165 . 144) (164 .
- 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (
- 4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (157 .
- 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93
- . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 .
- 172) (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 . 184) (2
- . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 . 190) (15
- . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (20 . 196)
- (21 . 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113 . 202) (
- 114 . 203) (115 . 204) (116 . 205) (109 . 470)) ((166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 .
- 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 .
- 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (
- 20 . 196) (21 . 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113
- . 202) (114 . 203) (115 . 204) (116 . 205) (109 . 469)) ((166 . 143) (165
- . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 .
- 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161)
- (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156
- . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174
- ) (155 . 175) (172 . 184) (178 . 468)) ((83 . 248) (48 . -274) (92 . -274)
- ) ((48 . 467)) ((-1 . -270)) ((59 . -244) (91 . -244) (89 . -244)) ((83 .
- -240) (84 . -240)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162
- . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6
- . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158)
- (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (168 . 174) (155 . 175) (85 . 179) (172 . 180) (144
- . 466)) ((83 . -236) (84 . -236) (48 . -236)) ((-1 . -186)) ((-1 . -6)) (
- (-1 . -7)) ((22 . 3) (28 . 4) (29 . 5) (30 . 6) (31 . 7) (32 . 8) (33 . 9)
- (34 . 10) (35 . 11) (36 . 12) (38 . 13) (37 . 14) (40 . 15) (24 . 16) (25
- . 17) (26 . 18) (27 . 19) (138 . 20) (139 . 21) (140 . 22) (141 . 23) (41
- . 24) (142 . 25) (143 . 26) (42 . 27) (43 . 28) (44 . 29) (45 . 30) (46
- . 60) (47 . 31) (147 . 32) (148 . 33) (149 . 34) (150 . 35) (170 . 379) (
- 171 . 464) (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (
- 161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7
- . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 .
- 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93
- . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 .
- 172) (176 . 173) (168 . 174) (155 . 175) (172 . 465)) ((92 . -19) (83 .
- -19)) ((85 . 433)) ((85 . 433) (-1 . -26)) ((8 . 150) (3 . 151) (4 . 152)
- (5 . 153) (6 . 52) (7 . 53) (179 . 156) (180 . 157) (181 . 158) (76 . 160)
- (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (177 . 167) (82 .
- 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (93 . 166) (168 . 231)
- (166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (
- 160 . 149) (159 . 154) (158 . 155) (157 . 159) (156 . 168) (155 . 463)) ((
- 166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (
- 160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (89 . 259) (91 . 260) (156 . 168) (82 . 169) (167 . 170) (86 .
- 171) (87 . 172) (176 . 173) (117 . 261) (168 . 174) (155 . 175) (118 . 262
- ) (85 . 179) (172 . 180) (144 . 263) (119 . 264) (173 . 462)) ((-1 . -34))
- ((-1 . -185)) ((-1 . -228)) ((166 . 143) (165 . 144) (164 . 145) (163 .
- 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5
- . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 461)) ((
- -1 . -221)) ((90 . 460)) ((166 . 143) (165 . 144) (164 . 145) (163 . 146)
- (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153
- ) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (181
- . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178)
- (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86
- . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172 . 458) (25 . 17
- ) (26 . 18) (27 . 19) (148 . 132) (90 . 459)) ((-1 . -222)) ((-1 . -231))
- ((-1 . -212)) ((-1 . -230)) ((92 . 457)) ((25 . 17) (26 . 18) (27 . 19) (
- 148 . 118) (125 . 456)) ((-1 . -216)) ((90 . 455) (-1 . -28)) ((90 . 454))
- ((166 . 143) (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148)
- (160 . 149) (8 . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159
- . 154) (158 . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 .
- 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (
- 177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176
- . 173) (168 . 174) (155 . 175) (172 . 451) (25 . 17) (26 . 18) (27 . 19) (
- 148 . 132) (90 . 452) (44 . 453)) ((90 . 482)) ((-1 . -214)) ((166 . 143)
- (165 . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8
- . 150) (3 . 151) (4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158
- . 155) (179 . 156) (180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 .
- 161) (78 . 162) (79 . 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (
- 156 . 168) (82 . 169) (167 . 170) (86 . 171) (87 . 172) (176 . 173) (168
- . 174) (155 . 175) (172 . 481)) ((-1 . -215)) ((-1 . -227)) ((90 . 479) (
- 25 . 17) (26 . 18) (27 . 19) (148 . 132) (166 . 143) (165 . 144) (164 .
- 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (
- 4 . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 .
- 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (
- 167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172
- . 480)) ((-1 . -229)) ((90 . 478)) ((-1 . -225)) ((-1 . -220)) ((90 . 477)
- ) ((84 . 475) (83 . 476)) ((-1 . -64)) ((92 . -18) (83 . -18)) ((92 . -16)
- (83 . -16)) ((83 . -239) (84 . -239)) ((166 . 143) (165 . 144) (164 . 145
- ) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4
- . 152) (5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 .
- 163) (80 . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (
- 167 . 170) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (172
- . 184) (178 . 418) (104 . 474) (92 . -273)) ((92 . 473) (83 . 248)) ((-1
- . -267)) ((-1 . -266)) ((17 . 472) (-1 . -264)) ((166 . 143) (165 . 144) (
- 164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 .
- 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (180 . 157) (
- 157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 . 178) (81 .
- 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170) (86 . 171)
- (87 . 172) (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53) (172 .
- 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 . 189) (14 .
- 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (85 . 108) (
- 20 . 196) (21 . 197) (181 . 198) (110 . 199) (111 . 200) (112 . 201) (113
- . 202) (114 . 203) (115 . 204) (116 . 205) (109 . 488)) ((48 . 487)) ((92
- . 486)) ((-1 . -13)) ((84 . 485) (166 . 143) (165 . 144) (164 . 145) (163
- . 146) (162 . 147) (161 . 148) (160 . 149) (8 . 150) (3 . 151) (4 . 152) (
- 5 . 153) (6 . 52) (7 . 53) (159 . 154) (158 . 155) (179 . 156) (180 . 157)
- (181 . 158) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80
- . 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170
- ) (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (85 . 179) (
- 172 . 180) (144 . 422) (89 . 259) (91 . 260) (117 . 261) (118 . 262) (119
- . 423)) ((-1 . -226)) ((-1 . -224)) ((-1 . -218)) ((90 . 484)) ((90 . 483)
- ) ((-1 . -213)) ((-1 . -219)) ((-1 . -217)) ((-1 . -14)) ((166 . 143) (165
- . 144) (164 . 145) (163 . 146) (162 . 147) (161 . 148) (160 . 149) (8 .
- 150) (3 . 151) (4 . 152) (5 . 153) (159 . 154) (158 . 155) (179 . 156) (
- 180 . 157) (157 . 159) (76 . 160) (77 . 161) (78 . 162) (79 . 163) (80 .
- 178) (81 . 165) (93 . 166) (177 . 167) (156 . 168) (82 . 169) (167 . 170)
- (86 . 171) (87 . 172) (176 . 173) (168 . 174) (155 . 175) (6 . 52) (7 . 53
- ) (172 . 184) (2 . 37) (9 . 185) (10 . 186) (11 . 187) (12 . 188) (13 .
- 189) (14 . 190) (15 . 191) (16 . 192) (19 . 193) (48 . 194) (178 . 195) (
- 85 . 108) (20 . 196) (21 . 197) (181 . 198) (110 . 199) (111 . 200) (112
- . 201) (113 . 202) (114 . 203) (115 . 204) (116 . 205) (109 . 489)) ((-1
- . -268)) ((-1 . -265)) ((-1 . -269))))
-
-(define c99-rto-v
- #(#f 177 177 177 177 176 176 176 176 176 176 176 176 176 176 175 175 175
- 175 171 171 168 168 168 168 168 168 167 167 167 167 167 167 166 166 165
- 165 165 165 164 164 164 163 163 163 162 162 162 162 162 161 161 161 160
- 160 159 159 158 158 157 157 156 156 155 155 172 172 154 154 154 154 154
- 154 154 154 154 154 154 178 178 130 106 106 152 170 170 170 170 170 170
- 170 170 153 153 146 146 150 150 150 150 150 149 149 149 149 149 149 149
- 149 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143 143
- 143 143 143 143 143 143 143 143 143 142 142 142 141 141 141 141 140 140
- 140 140 140 140 137 137 136 136 136 136 135 133 133 133 133 132 132 131
- 131 131 139 139 139 139 139 129 129 128 128 148 148 148 147 145 145 126
- 126 126 126 126 126 126 126 126 126 126 126 126 127 127 127 127 125 125
- 124 124 122 122 121 121 121 123 123 174 174 169 169 169 120 120 120 120
- 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 120 138
- 144 144 144 173 173 173 173 119 118 118 117 117 109 109 109 109 109 109
- 109 116 116 116 115 115 108 108 107 107 114 114 113 113 113 112 112 112
- 105 105 105 104 104 111 111 111 111 111 182 103 103 102 102 102 102 102
- 102 102 101 101 99 99 151 151 181 181 180 180 180 179 179 98 134 110 100))
-
-(define c99-mtab
- '((cpp-pragma . 1) (cpp-stmt . 2) ($chlit . 3) ($float . 4) ($fixed . 5) (
- cpp-ident . 6) ($ident . 7) ($string . 8) ("return" . 9) ("break" . 10) (
- "continue" . 11) ("goto" . 12) ("for" . 13) ("do" . 14) ("while" . 15) (
- "switch" . 16) ("else" . 17) (then . 18) ("if" . 19) ("default" . 20) (
- "case" . 21) (typename . 22) ("..." . 23) ("inline" . 24) ("restrict" . 25
- ) ("volatile" . 26) ("const" . 27) ("enum" . 28) ("union" . 29) ("struct"
- . 30) ("_Complex" . 31) ("double" . 32) ("float" . 33) ("char" . 34) (
- "unsigned" . 35) ("long" . 36) ("signed" . 37) ("int" . 38) (imp . 39) (
- "short" . 40) ("_Bool" . 41) ("void" . 42) ("typedef" . 43) ("static" . 44
- ) ("register" . 45) ("extern" . 46) ("auto" . 47) (";" . 48) ("|=" . 49) (
- "^=" . 50) ("&=" . 51) (">>=" . 52) ("<<=" . 53) ("%=" . 54) ("/=" . 55) (
- "*=" . 56) ("-=" . 57) ("+=" . 58) ("=" . 59) (":" . 60) ("?" . 61) ("||"
- . 62) ("&&" . 63) ("|" . 64) ("^" . 65) ("!=" . 66) ("==" . 67) (">=" . 68
- ) ("<=" . 69) (">" . 70) ("<" . 71) (">>" . 72) ("<<" . 73) ("%" . 74) (
- "/" . 75) ("!" . 76) ("~" . 77) ("-" . 78) ("+" . 79) ("*" . 80) ("&" . 81
- ) ("sizeof" . 82) ("," . 83) ("}" . 84) ("{" . 85) ("--" . 86) ("++" . 87)
- ("->" . 88) ("." . 89) ("]" . 90) ("[" . 91) (")" . 92) ("(" . 93) (
- $code-comm . 94) ($lone-comm . 95) ($error . 96) ($end . 97)))
-
-;;; end tables
+++ /dev/null
-;; ./mach.d/c99xact.scm
-
-;; Copyright (C) 2016,2017 Matthew R. Wette
-;;
-;; This software is covered by the GNU GENERAL PUBLIC LICENCE, Version 3,
-;; or any later version published by the Free Software Foundation. See
-;; the file COPYING included with the this distribution.
-
-(define c99x-act-v
- (vector
- ;; $start => expression
- (lambda ($1 . $rest) $1)
- ;; primary-expression => identifier
- (lambda ($1 . $rest) `(p-expr ,$1))
- ;; primary-expression => constant
- (lambda ($1 . $rest) `(p-expr ,$1))
- ;; primary-expression => string-literal
- (lambda ($1 . $rest) `(p-expr ,(tl->list $1)))
- ;; primary-expression => "(" expression ")"
- (lambda ($3 $2 $1 . $rest) $2)
- ;; postfix-expression => primary-expression
- (lambda ($1 . $rest) $1)
- ;; postfix-expression => postfix-expression "[" expression "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-ref ,$3 ,$1))
- ;; postfix-expression => postfix-expression "(" argument-expression-list...
- (lambda ($4 $3 $2 $1 . $rest)
- `(fctn-call ,$1 ,(tl->list $3)))
- ;; postfix-expression => postfix-expression "(" ")"
- (lambda ($3 $2 $1 . $rest)
- `(fctn-call ,$1 (expr-list)))
- ;; postfix-expression => postfix-expression "." identifier
- (lambda ($3 $2 $1 . $rest) `(d-sel ,$3 ,$1))
- ;; postfix-expression => postfix-expression "->" identifier
- (lambda ($3 $2 $1 . $rest) `(i-sel ,$3 ,$1))
- ;; postfix-expression => postfix-expression "++"
- (lambda ($2 $1 . $rest) `(post-inc ,$1))
- ;; postfix-expression => postfix-expression "--"
- (lambda ($2 $1 . $rest) `(post-dec ,$1))
- ;; postfix-expression => "(" type-name ")" "{" initializer-list "}"
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(comp-lit ,$2 ,(tl->list $5)))
- ;; postfix-expression => "(" type-name ")" "{" initializer-list "," "}"
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(comp-lit ,$2 ,(tl->list $5)))
- ;; argument-expression-list => assignment-expression
- (lambda ($1 . $rest) (make-tl 'expr-list $1))
- ;; argument-expression-list => argument-expression-list "," assignment-e...
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; argument-expression-list => arg-expr-hack
- (lambda ($1 . $rest) (make-tl 'expr-list $1))
- ;; argument-expression-list => argument-expression-list "," arg-expr-hack
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; arg-expr-hack => declaration-specifiers abstract-declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) $2))
- ;; arg-expr-hack => declaration-specifiers
- (lambda ($1 . $rest)
- `(param-decl ,(tl->list $1)))
- ;; unary-expression => postfix-expression
- (lambda ($1 . $rest) $1)
- ;; unary-expression => "++" unary-expression
- (lambda ($2 $1 . $rest) `(pre-inc ,$2))
- ;; unary-expression => "--" unary-expression
- (lambda ($2 $1 . $rest) `(pre-dec ,$2))
- ;; unary-expression => unary-operator cast-expression
- (lambda ($2 $1 . $rest) (list $1 $2))
- ;; unary-expression => "sizeof" unary-expression
- (lambda ($2 $1 . $rest) `(sizeof-expr ,$2))
- ;; unary-expression => "sizeof" "(" type-name ")"
- (lambda ($4 $3 $2 $1 . $rest) `(sizeof-type ,$3))
- ;; unary-operator => "&"
- (lambda ($1 . $rest) 'ref-to)
- ;; unary-operator => "*"
- (lambda ($1 . $rest) 'de-ref)
- ;; unary-operator => "+"
- (lambda ($1 . $rest) 'pos)
- ;; unary-operator => "-"
- (lambda ($1 . $rest) 'neg)
- ;; unary-operator => "~"
- (lambda ($1 . $rest) 'bitwise-not)
- ;; unary-operator => "!"
- (lambda ($1 . $rest) 'not)
- ;; cast-expression => unary-expression
- (lambda ($1 . $rest) $1)
- ;; cast-expression => "(" type-name ")" cast-expression
- (lambda ($4 $3 $2 $1 . $rest) `(cast ,$2 ,$4))
- ;; multiplicative-expression => cast-expression
- (lambda ($1 . $rest) $1)
- ;; multiplicative-expression => multiplicative-expression "*" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(mul ,$1 ,$3))
- ;; multiplicative-expression => multiplicative-expression "/" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(div ,$1 ,$3))
- ;; multiplicative-expression => multiplicative-expression "%" cast-expre...
- (lambda ($3 $2 $1 . $rest) `(mod ,$1 ,$3))
- ;; additive-expression => multiplicative-expression
- (lambda ($1 . $rest) $1)
- ;; additive-expression => additive-expression "+" multiplicative-expression
- (lambda ($3 $2 $1 . $rest) `(add ,$1 ,$3))
- ;; additive-expression => additive-expression "-" multiplicative-expression
- (lambda ($3 $2 $1 . $rest) `(sub ,$1 ,$3))
- ;; shift-expression => additive-expression
- (lambda ($1 . $rest) $1)
- ;; shift-expression => shift-expression "<<" additive-expression
- (lambda ($3 $2 $1 . $rest) `(lshift ,$1 ,$3))
- ;; shift-expression => shift-expression ">>" additive-expression
- (lambda ($3 $2 $1 . $rest) `(rshift ,$1 ,$3))
- ;; relational-expression => shift-expression
- (lambda ($1 . $rest) $1)
- ;; relational-expression => relational-expression "<" shift-expression
- (lambda ($3 $2 $1 . $rest) `(lt ,$1 ,$3))
- ;; relational-expression => relational-expression ">" shift-expression
- (lambda ($3 $2 $1 . $rest) `(gt ,$1 ,$3))
- ;; relational-expression => relational-expression "<=" shift-expression
- (lambda ($3 $2 $1 . $rest) `(le ,$1 ,$3))
- ;; relational-expression => relational-expression ">=" shift-expression
- (lambda ($3 $2 $1 . $rest) `(ge ,$1 ,$3))
- ;; equality-expression => relational-expression
- (lambda ($1 . $rest) $1)
- ;; equality-expression => equality-expression "==" relational-expression
- (lambda ($3 $2 $1 . $rest) `(eq ,$1 ,$3))
- ;; equality-expression => equality-expression "!=" relational-expression
- (lambda ($3 $2 $1 . $rest) `(ne ,$1 ,$3))
- ;; bitwise-and-expression => equality-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-and-expression => bitwise-and-expression "&" equality-expression
- (lambda ($3 $2 $1 . $rest)
- `(bitwise-and ,$1 ,$3))
- ;; bitwise-xor-expression => bitwise-and-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-xor-expression => bitwise-xor-expression "^" bitwise-and-expr...
- (lambda ($3 $2 $1 . $rest)
- `(bitwise-xor ,$1 ,$3))
- ;; bitwise-or-expression => bitwise-xor-expression
- (lambda ($1 . $rest) $1)
- ;; bitwise-or-expression => bitwise-or-expression "|" bitwise-xor-expres...
- (lambda ($3 $2 $1 . $rest) `(bitwise-or ,$1 ,$3))
- ;; logical-and-expression => bitwise-or-expression
- (lambda ($1 . $rest) $1)
- ;; logical-and-expression => logical-and-expression "&&" bitwise-or-expr...
- (lambda ($3 $2 $1 . $rest) `(and ,$1 ,$3))
- ;; logical-or-expression => logical-and-expression
- (lambda ($1 . $rest) $1)
- ;; logical-or-expression => logical-or-expression "||" logical-and-expre...
- (lambda ($3 $2 $1 . $rest) `(or ,$1 ,$3))
- ;; conditional-expression => logical-or-expression
- (lambda ($1 . $rest) $1)
- ;; conditional-expression => logical-or-expression "?" expression ":" co...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(cond-expr ,$1 ,$3 ,$5))
- ;; assignment-expression => conditional-expression
- (lambda ($1 . $rest) $1)
- ;; assignment-expression => unary-expression assignment-operator assignm...
- (lambda ($3 $2 $1 . $rest)
- `(assn-expr ,$1 (op ,$2) ,$3))
- ;; assignment-operator => "="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "+="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "-="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "*="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "/="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "%="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "<<="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => ">>="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "&="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "^="
- (lambda ($1 . $rest) $1)
- ;; assignment-operator => "|="
- (lambda ($1 . $rest) $1)
- ;; expression => assignment-expression
- (lambda ($1 . $rest) $1)
- ;; expression => expression "," assignment-expression
- (lambda ($3 $2 $1 . $rest)
- (if (eqv? 'comma-expr (sx-tag $1))
- (append $1 (list $3))
- `(comma-expr ,$1 ,$3)))
- ;; constant-expression => conditional-expression
- (lambda ($1 . $rest) $1)
- ;; declaration => declaration-specifiers init-declarator-list $P1 ";" op...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- (if (pair? $5) (append $3 (list $5)) $3))
- ;; declaration => declaration-specifiers ";" opt-code-comment
- (lambda ($3 $2 $1 . $rest)
- (if (pair? $3)
- `(decl ,(tl->list $1) ,(list $3))
- `(decl ,(tl->list $1))))
- ;; $P1 =>
- (lambda ($2 $1 . $rest)
- (save-typenames
- `(decl ,(tl->list $1) ,(tl->list $2))))
- ;; declaration-specifiers => storage-class-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => storage-class-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => type-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => type-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => type-qualifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; declaration-specifiers => function-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; declaration-specifiers => function-specifier declaration-specifiers
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; init-declarator-list => init-declarator
- (lambda ($1 . $rest)
- (make-tl 'init-declr-list $1))
- ;; init-declarator-list => init-declarator-list "," init-declarator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; init-declarator => declarator
- (lambda ($1 . $rest) `(init-declr ,$1))
- ;; init-declarator => declarator "=" initializer
- (lambda ($3 $2 $1 . $rest) `(init-declr ,$1 ,$3))
- ;; storage-class-specifier => "auto"
- (lambda ($1 . $rest) '(stor-spec (auto)))
- ;; storage-class-specifier => "extern"
- (lambda ($1 . $rest) '(stor-spec (extern)))
- ;; storage-class-specifier => "register"
- (lambda ($1 . $rest) '(stor-spec (register)))
- ;; storage-class-specifier => "static"
- (lambda ($1 . $rest) '(stor-spec (static)))
- ;; storage-class-specifier => "typedef"
- (lambda ($1 . $rest) '(stor-spec (typedef)))
- ;; type-specifier => "void"
- (lambda ($1 . $rest) '(type-spec (void)))
- ;; type-specifier => fixed-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => float-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => "_Bool"
- (lambda ($1 . $rest)
- '(type-spec (fixed-type "_Bool")))
- ;; type-specifier => complex-type-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => struct-or-union-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => enum-specifier
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; type-specifier => typedef-name
- (lambda ($1 . $rest) `(type-spec ,$1))
- ;; fixed-type-specifier => "short"
- (lambda ($1 . $rest) '(fixed-type "short"))
- ;; fixed-type-specifier => "short" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "short int"))
- ;; fixed-type-specifier => "signed" "short"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed short"))
- ;; fixed-type-specifier => "signed" "short" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed short int"))
- ;; fixed-type-specifier => "int"
- (lambda ($1 . $rest) '(fixed-type "int"))
- ;; fixed-type-specifier => "signed"
- (lambda ($1 . $rest) '(fixed-type "signed"))
- ;; fixed-type-specifier => "signed" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed int"))
- ;; fixed-type-specifier => "long"
- (lambda ($1 . $rest) '(fixed-type "long"))
- ;; fixed-type-specifier => "long" "int"
- (lambda ($2 $1 . $rest) '(fixed-type "long int"))
- ;; fixed-type-specifier => "signed" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed long"))
- ;; fixed-type-specifier => "signed" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed long int"))
- ;; fixed-type-specifier => "long" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "long long"))
- ;; fixed-type-specifier => "long" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "long long int"))
- ;; fixed-type-specifier => "signed" "long" "long"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "signed long long"))
- ;; fixed-type-specifier => "signed" "long" "long" "int"
- (lambda ($4 $3 $2 $1 . $rest)
- '(fixed-type "signed long long int"))
- ;; fixed-type-specifier => "unsigned" "short" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned short int"))
- ;; fixed-type-specifier => "unsigned" "short"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned short"))
- ;; fixed-type-specifier => "unsigned" "int"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned int"))
- ;; fixed-type-specifier => "unsigned"
- (lambda ($1 . $rest) '(fixed-type "unsigned"))
- ;; fixed-type-specifier => "unsigned" "long" "int"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned long"))
- ;; fixed-type-specifier => "unsigned" "long"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned long"))
- ;; fixed-type-specifier => "unsigned" "long" "long" "int"
- (lambda ($4 $3 $2 $1 . $rest)
- '(fixed-type "unsigned long long int"))
- ;; fixed-type-specifier => "unsigned" "long" "long"
- (lambda ($3 $2 $1 . $rest)
- '(fixed-type "unsigned long long"))
- ;; fixed-type-specifier => "char"
- (lambda ($1 . $rest) '(fixed-type "char"))
- ;; fixed-type-specifier => "signed" "char"
- (lambda ($2 $1 . $rest)
- '(fixed-type "signed char"))
- ;; fixed-type-specifier => "unsigned" "char"
- (lambda ($2 $1 . $rest)
- '(fixed-type "unsigned char"))
- ;; float-type-specifier => "float"
- (lambda ($1 . $rest) '(float-type "float"))
- ;; float-type-specifier => "double"
- (lambda ($1 . $rest) '(float-type "double"))
- ;; float-type-specifier => "long" "double"
- (lambda ($2 $1 . $rest)
- '(float-type "long double"))
- ;; complex-type-specifier => "_Complex"
- (lambda ($1 . $rest) '(complex-type "_Complex"))
- ;; complex-type-specifier => "float" "_Complex"
- (lambda ($2 $1 . $rest)
- '(complex-type "float _Complex"))
- ;; complex-type-specifier => "double" "_Complex"
- (lambda ($2 $1 . $rest)
- '(complex-type "double _Complex"))
- ;; complex-type-specifier => "long" "double" "_Complex"
- (lambda ($3 $2 $1 . $rest)
- '(complex-type "long double _Complex"))
- ;; struct-or-union-specifier => "struct" ident-like "{" struct-declarati...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(struct-def ,$2 ,(tl->list $4)))
- ;; struct-or-union-specifier => "struct" "{" struct-declaration-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(struct-def ,(tl->list $3)))
- ;; struct-or-union-specifier => "struct" ident-like
- (lambda ($2 $1 . $rest) `(struct-ref ,$2))
- ;; struct-or-union-specifier => "union" ident-like "{" struct-declaratio...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(union-def ,$2 ,(tl->list $4)))
- ;; struct-or-union-specifier => "union" "{" struct-declaration-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(union-def ,(tl->list $3)))
- ;; struct-or-union-specifier => "union" ident-like
- (lambda ($2 $1 . $rest) `(union-ref ,$2))
- ;; ident-like => identifier
- (lambda ($1 . $rest) $1)
- ;; ident-like => typedef-name
- (lambda ($1 . $rest) `(ident ,(cdr $1)))
- ;; struct-declaration-list => struct-declaration
- (lambda ($1 . $rest) (make-tl 'field-list $1))
- ;; struct-declaration-list => lone-comment
- (lambda ($1 . $rest) (make-tl 'field-list $1))
- ;; struct-declaration-list => struct-declaration-list struct-declaration
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; struct-declaration-list => struct-declaration-list lone-comment
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; struct-declaration => specifier-qualifier-list struct-declarator-list...
- (lambda ($4 $3 $2 $1 . $rest)
- (if (pair? $4)
- `(comp-decl ,(tl->list $1) ,(tl->list $2) ,$4)
- `(comp-decl ,(tl->list $1) ,(tl->list $2))))
- ;; specifier-qualifier-list => type-specifier specifier-qualifier-list
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; specifier-qualifier-list => type-specifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; specifier-qualifier-list => type-qualifier specifier-qualifier-list
- (lambda ($2 $1 . $rest) (tl-insert $2 $1))
- ;; specifier-qualifier-list => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; struct-declarator-list => struct-declarator
- (lambda ($1 . $rest)
- (make-tl 'comp-declr-list $1))
- ;; struct-declarator-list => struct-declarator-list "," struct-declarator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; struct-declarator => declarator
- (lambda ($1 . $rest) `(comp-declr ,$1))
- ;; struct-declarator => declarator ":" constant-expression
- (lambda ($3 $2 $1 . $rest)
- `(comp-declr (bit-field ,$1 ,$3)))
- ;; struct-declarator => ":" constant-expression
- (lambda ($2 $1 . $rest)
- `(comp-declr (bit-field ,$2)))
- ;; enum-specifier => "enum" ident-like "{" enumerator-list "}"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(enum-def ,$2 ,(tl->list $4)))
- ;; enum-specifier => "enum" ident-like "{" enumerator-list "," "}"
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(enum-def ,$2 ,(tl->list $4)))
- ;; enum-specifier => "enum" "{" enumerator-list "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(enum-def ,(tl->list $3)))
- ;; enum-specifier => "enum" "{" enumerator-list "," "}"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(enum-def ,(tl->list $3)))
- ;; enum-specifier => "enum" ident-like
- (lambda ($2 $1 . $rest) `(enum-ref ,$2))
- ;; enumerator-list => enumerator
- (lambda ($1 . $rest) (make-tl 'enum-def-list $1))
- ;; enumerator-list => enumerator-list "," enumerator
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; enumerator => identifier
- (lambda ($1 . $rest) `(enum-defn ,$1))
- ;; enumerator => identifier "=" constant-expression
- (lambda ($3 $2 $1 . $rest) `(enum-defn ,$1 ,$3))
- ;; type-qualifier => "const"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; type-qualifier => "volatile"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; type-qualifier => "restrict"
- (lambda ($1 . $rest) `(type-qual ,$1))
- ;; function-specifier => "inline"
- (lambda ($1 . $rest) `(fctn-spec ,$1))
- ;; declarator => pointer direct-declarator
- (lambda ($2 $1 . $rest) `(ptr-declr ,$1 ,$2))
- ;; declarator => direct-declarator
- (lambda ($1 . $rest) $1)
- ;; direct-declarator => identifier
- (lambda ($1 . $rest) $1)
- ;; direct-declarator => "(" declarator ")"
- (lambda ($3 $2 $1 . $rest) `(scope ,$2))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3 ,$4))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3))
- ;; direct-declarator => direct-declarator "[" assignment-expression "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3))
- ;; direct-declarator => direct-declarator "[" "]"
- (lambda ($3 $2 $1 . $rest) `(array-of ,$1))
- ;; direct-declarator => direct-declarator "[" "static" type-qualifier-li...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(array-of
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))
- ,$5))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "stati...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(array-of
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$5))
- ;; direct-declarator => direct-declarator "[" type-qualifier-list "*" "]"
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(array-of ,$1 ,$3 (var-len)))
- ;; direct-declarator => direct-declarator "[" "*" "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(array-of ,$1 (var-len)))
- ;; direct-declarator => direct-declarator "(" parameter-type-list ")"
- (lambda ($4 $3 $2 $1 . $rest)
- `(ftn-declr ,$1 ,(tl->list $3)))
- ;; direct-declarator => direct-declarator "(" identifier-list ")"
- (lambda ($4 $3 $2 $1 . $rest)
- `(ftn-declr ,$1 ,(tl->list $3)))
- ;; direct-declarator => direct-declarator "(" ")"
- (lambda ($3 $2 $1 . $rest)
- `(ftn-declr ,$1 (param-list)))
- ;; pointer => "*" type-qualifier-list
- (lambda ($2 $1 . $rest)
- `(pointer ,(tl->list $2)))
- ;; pointer => "*"
- (lambda ($1 . $rest) '(pointer))
- ;; pointer => "*" type-qualifier-list pointer
- (lambda ($3 $2 $1 . $rest)
- `(pointer ,(tl->list $2) ,$3))
- ;; pointer => "*" pointer
- (lambda ($2 $1 . $rest) `(pointer ,$2))
- ;; type-qualifier-list => type-qualifier
- (lambda ($1 . $rest)
- (make-tl 'decl-spec-list $1))
- ;; type-qualifier-list => type-qualifier-list type-qualifier
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; parameter-type-list => parameter-list
- (lambda ($1 . $rest) $1)
- ;; parameter-type-list => parameter-list "," "..."
- (lambda ($3 $2 $1 . $rest)
- (tl-append $1 '(ellipsis)))
- ;; parameter-list => parameter-declaration
- (lambda ($1 . $rest) (make-tl 'param-list $1))
- ;; parameter-list => parameter-list "," parameter-declaration
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; parameter-declaration => declaration-specifiers declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) (param-declr ,$2)))
- ;; parameter-declaration => declaration-specifiers abstract-declarator
- (lambda ($2 $1 . $rest)
- `(param-decl ,(tl->list $1) (param-declr ,$2)))
- ;; parameter-declaration => declaration-specifiers
- (lambda ($1 . $rest)
- `(param-decl ,(tl->list $1)))
- ;; identifier-list => identifier
- (lambda ($1 . $rest) (make-tl 'ident-list $1))
- ;; identifier-list => identifier-list "," identifier
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; type-name => specifier-qualifier-list abstract-declarator
- (lambda ($2 $1 . $rest)
- `(type-name ,(tl->list $1) ,$2))
- ;; type-name => declaration-specifiers
- (lambda ($1 . $rest) `(type-name ,(tl->list $1)))
- ;; abstract-declarator => pointer
- (lambda ($1 . $rest) `(abs-declr ,$1))
- ;; abstract-declarator => pointer direct-abstract-declarator
- (lambda ($2 $1 . $rest) `(abs-declr ,$1 ,$2))
- ;; abstract-declarator => direct-abstract-declarator
- (lambda ($1 . $rest) `(abs-declr ,$1))
- ;; direct-abstract-declarator => "(" abstract-declarator ")"
- (lambda ($3 $2 $1 . $rest) `(declr-scope ,$2))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-array ,$3 ,$4))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-array ,$1 ,$3))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" assignme...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-array ,$1 ,$3))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "]"
- (lambda ($3 $2 $1 . $rest) `(declr-array ,$1))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "static"...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))
- ,$5))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "static"...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $4))))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" type-qua...
- (lambda ($6 $5 $4 $3 $2 $1 . $rest)
- `(declr-array
- ,$1
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$5))
- ;; direct-abstract-declarator => "[" type-qualifier-list assignment-expr...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-anon-array ,$2 ,$3))
- ;; direct-abstract-declarator => "[" type-qualifier-list "]"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-array ,$2))
- ;; direct-abstract-declarator => "[" assignment-expression "]"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-array ,$2))
- ;; direct-abstract-declarator => "[" "]"
- (lambda ($2 $1 . $rest) `(declr-anon-array))
- ;; direct-abstract-declarator => "[" "static" type-qualifier-list assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $3))
- ,$4))
- ;; direct-abstract-declarator => "[" "static" type-qualifier-list "]"
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $3))))
- ;; direct-abstract-declarator => "[" type-qualifier-list "static" assign...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(declr-anon-array
- ,(tl->list (tl-insert '(stor-spec "static") $2))
- ,$4))
- ;; direct-abstract-declarator => direct-abstract-declarator "[" "*" "]"
- (lambda ($4 $3 $2 $1 . $rest) `(declr-STAR ,$1))
- ;; direct-abstract-declarator => "[" "*" "]"
- (lambda ($3 $2 $1 . $rest) '(declr-STAR))
- ;; direct-abstract-declarator => direct-abstract-declarator "(" paramete...
- (lambda ($4 $3 $2 $1 . $rest)
- `(declr-fctn ,$1 ,(tl->list $3)))
- ;; direct-abstract-declarator => direct-abstract-declarator "(" ")"
- (lambda ($3 $2 $1 . $rest) `(declr-fctn ,$1))
- ;; direct-abstract-declarator => "(" parameter-type-list ")"
- (lambda ($3 $2 $1 . $rest)
- `(declr-anon-fctn ,(tl->list $2)))
- ;; direct-abstract-declarator => "(" ")"
- (lambda ($2 $1 . $rest) '(declr-anon-fctn))
- ;; typedef-name => 'typename
- (lambda ($1 . $rest) `(typename ,$1))
- ;; initializer => assignment-expression
- (lambda ($1 . $rest) `(initzer ,$1))
- ;; initializer => "{" initializer-list "}"
- (lambda ($3 $2 $1 . $rest)
- `(initzer ,(tl->list $2)))
- ;; initializer => "{" initializer-list "," "}"
- (lambda ($4 $3 $2 $1 . $rest)
- `(initzer ,(tl->list $2)))
- ;; initializer-list => designation initializer
- (lambda ($2 $1 . $rest)
- (make-tl 'initzer-list $1 $2))
- ;; initializer-list => initializer
- (lambda ($1 . $rest) (make-tl 'initzer-list $1))
- ;; initializer-list => initializer-list "," designation initializer
- (lambda ($4 $3 $2 $1 . $rest)
- (tl-append $1 $3 $4))
- ;; initializer-list => initializer-list "," initializer
- (lambda ($3 $2 $1 . $rest) (tl-append $1 $3))
- ;; designation => designator-list "="
- (lambda ($2 $1 . $rest) `(desig ,$1))
- ;; designator-list => designator
- (lambda ($1 . $rest) (make-tl 'desgr-list $1))
- ;; designator-list => designator-list designator
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; designator => "[" constant-expression "]"
- (lambda ($3 $2 $1 . $rest) (list 'array-dsgr $2))
- ;; designator => "." identifier
- (lambda ($2 $1 . $rest) (list 'sel-dsgr $2))
- ;; statement => labeled-statement
- (lambda ($1 . $rest) $1)
- ;; statement => compound-statement
- (lambda ($1 . $rest) $1)
- ;; statement => expression-statement
- (lambda ($1 . $rest) $1)
- ;; statement => selection-statement
- (lambda ($1 . $rest) $1)
- ;; statement => iteration-statement
- (lambda ($1 . $rest) $1)
- ;; statement => jump-statement
- (lambda ($1 . $rest) $1)
- ;; statement => cpp-statement
- (lambda ($1 . $rest) $1)
- ;; labeled-statement => identifier ":" statement
- (lambda ($3 $2 $1 . $rest)
- `(labeled-stmt ,$1 ,$3))
- ;; labeled-statement => "case" constant-expression ":" statement
- (lambda ($4 $3 $2 $1 . $rest) `(case ,$2 ,$4))
- ;; labeled-statement => "default" ":" statement
- (lambda ($3 $2 $1 . $rest) `(default ,$3))
- ;; compound-statement => "{" block-item-list "}"
- (lambda ($3 $2 $1 . $rest)
- `(compd-stmt ,(tl->list $2)))
- ;; compound-statement => "{" "}"
- (lambda ($2 $1 . $rest)
- `(compd-stmt (block-item-list)))
- ;; block-item-list => block-item
- (lambda ($1 . $rest)
- (make-tl 'block-item-list $1))
- ;; block-item-list => block-item-list block-item
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; block-item => declaration
- (lambda ($1 . $rest) $1)
- ;; block-item => statement
- (lambda ($1 . $rest) $1)
- ;; expression-statement => expression ";"
- (lambda ($2 $1 . $rest) `(expr-stmt ,$1))
- ;; expression-statement => ";"
- (lambda ($1 . $rest) '(expr-stmt))
- ;; selection-statement => "if" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest) `(if ,$3 ,$5))
- ;; selection-statement => "if" "(" expression ")" statement "else" state...
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(if ,$3 ,$5 ,$7))
- ;; selection-statement => "switch" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(switch ,$3 ,$5))
- ;; iteration-statement => "while" "(" expression ")" statement
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(while ,$3 ,$5))
- ;; iteration-statement => "do" statement "while" "(" expression ")" ";"
- (lambda ($7 $6 $5 $4 $3 $2 $1 . $rest)
- `(do-while ,$2 ,$5))
- ;; iteration-statement => "for" "(" initial-clause opt-expression ";" op...
- (lambda ($8 $7 $6 $5 $4 $3 $2 $1 . $rest)
- `(for ,$3 ,$4 ,$6 ,$8))
- ;; initial-clause => expression ";"
- (lambda ($2 $1 . $rest) $1)
- ;; initial-clause => ";"
- (lambda ($1 . $rest) '(expr))
- ;; initial-clause => declaration
- (lambda ($1 . $rest) $1)
- ;; opt-expression =>
- (lambda $rest '(expr))
- ;; opt-expression => expression
- (lambda ($1 . $rest) $1)
- ;; jump-statement => "goto" identifier ";"
- (lambda ($3 $2 $1 . $rest) `(goto ,$2))
- ;; jump-statement => "continue" ";"
- (lambda ($2 $1 . $rest) '(continue))
- ;; jump-statement => "break" ";"
- (lambda ($2 $1 . $rest) '(break))
- ;; jump-statement => "return" expression ";"
- (lambda ($3 $2 $1 . $rest) `(return ,$2))
- ;; jump-statement => "return" ";"
- (lambda ($2 $1 . $rest) `(return (expr)))
- ;; translation-unit => external-declaration-list
- (lambda ($1 . $rest) (tl->list $1))
- ;; external-declaration-list =>
- (lambda $rest (make-tl 'trans-unit))
- ;; external-declaration-list => external-declaration-list external-decla...
- (lambda ($2 $1 . $rest)
- (if (eqv? (sx-tag $2) 'extern-block)
- (tl-extend $1 (sx-tail $2 1))
- (tl-append $1 $2)))
- ;; external-declaration => function-definition
- (lambda ($1 . $rest) $1)
- ;; external-declaration => declaration
- (lambda ($1 . $rest) $1)
- ;; external-declaration => lone-comment
- (lambda ($1 . $rest) $1)
- ;; external-declaration => cpp-statement
- (lambda ($1 . $rest) $1)
- ;; external-declaration => pragma
- (lambda ($1 . $rest) $1)
- ;; external-declaration => "extern" '$string "{" external-declaration-li...
- (lambda ($5 $4 $3 $2 $1 . $rest)
- `(extern-block
- (extern-begin ,$2)
- ,@(sx-tail (tl->list $4) 1)
- (extern-end)))
- ;; external-declaration => ";"
- (lambda ($1 . $rest)
- `(decl (@ (extension . "GNU C"))))
- ;; function-definition => declaration-specifiers declarator declaration-...
- (lambda ($4 $3 $2 $1 . $rest)
- `(knr-fctn-defn
- ,(tl->list $1)
- ,$2
- ,(tl->list $3)
- ,$4))
- ;; function-definition => declaration-specifiers declarator compound-sta...
- (lambda ($3 $2 $1 . $rest)
- `(fctn-defn ,(tl->list $1) ,$2 ,$3))
- ;; declaration-list => declaration
- (lambda ($1 . $rest) (make-tl $1))
- ;; declaration-list => declaration-list declaration
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; opt-code-comment =>
- (lambda $rest (list))
- ;; opt-code-comment => code-comment
- (lambda ($1 . $rest) $1)
- ;; identifier => '$ident
- (lambda ($1 . $rest) `(ident ,$1))
- ;; identifier => 'cpp-ident
- (lambda ($1 . $rest) `(ident ,$1))
- ;; constant => '$fixed
- (lambda ($1 . $rest) `(fixed ,$1))
- ;; constant => '$float
- (lambda ($1 . $rest) `(float ,$1))
- ;; constant => '$chlit
- (lambda ($1 . $rest) `(char ,$1))
- ;; string-literal => '$string
- (lambda ($1 . $rest) (make-tl 'string $1))
- ;; string-literal => string-literal '$string
- (lambda ($2 $1 . $rest) (tl-append $1 $2))
- ;; code-comment => '$code-comm
- (lambda ($1 . $rest) `(comment ,$1))
- ;; lone-comment => '$lone-comm
- (lambda ($1 . $rest) `(comment ,$1))
- ;; cpp-statement => 'cpp-stmt
- (lambda ($1 . $rest) `(cpp-stmt ,$1))
- ;; pragma => 'cpp-pragma
- (lambda ($1 . $rest) $1)
- ))
-
-;;; end tables
+++ /dev/null
-;; ./mach.d/c99xtab.scm
-
-;; Copyright (C) 2016,2017 Matthew R. Wette
-;;
-;; This software is covered by the GNU GENERAL PUBLIC LICENCE, Version 3,
-;; or any later version published by the Free Software Foundation. See
-;; the file COPYING included with the this distribution.
-
-(define c99x-len-v
- #(1 1 1 1 3 1 4 4 3 3 3 2 2 6 7 1 3 1 3 2 1 1 2 2 2 2 4 1 1 1 1 1 1 1 4 1
- 3 3 3 1 3 3 1 3 3 1 3 3 3 3 1 3 3 1 3 1 3 1 3 1 3 1 3 1 5 1 3 1 1 1 1 1 1
- 1 1 1 1 1 1 3 1 5 3 0 1 2 1 2 1 2 1 2 1 3 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1
- 2 2 3 1 1 2 1 2 2 3 2 3 3 4 3 2 2 1 3 2 4 3 1 2 2 1 1 2 1 2 2 3 5 4 2 5 4
- 2 1 1 1 1 2 2 4 2 1 2 1 1 3 1 3 2 5 6 4 5 2 1 3 1 3 1 1 1 1 2 1 1 3 5 4 4
- 3 6 6 5 4 4 4 3 2 1 3 2 1 2 1 3 1 3 2 2 1 1 3 2 1 1 2 1 3 5 4 4 3 6 5 6 4
- 3 3 2 5 4 5 4 3 4 3 3 2 1 1 3 4 2 1 4 3 2 1 2 3 2 1 1 1 1 1 1 1 3 4 3 3 2
- 1 2 1 1 2 1 5 7 5 5 7 8 2 1 1 0 1 3 2 2 3 2 1 0 2 1 1 1 1 1 5 1 4 3 1 2 0
- 1 1 1 1 1 1 1 2 1 1 1 1))
-
-(define c99x-pat-v
- #(((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160 . 7) (
- 8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (158 . 15) (
- 179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21) (78 . 22) (
- 79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (82 . 29) (
- 167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (172 . 36)
- (178 . 37)) ((97 . -35) (-1 . -35)) ((80 . 119) (75 . 120) (74 . 121) (97
- . -39) (-1 . -39)) ((79 . 117) (78 . 118) (97 . -42) (-1 . -42)) ((73 .
- 115) (72 . 116) (97 . -45) (-1 . -45)) ((71 . 111) (70 . 112) (69 . 113) (
- 68 . 114) (97 . -50) (-1 . -50)) ((67 . 109) (66 . 110) (97 . -53) (-1 .
- -53)) ((81 . 108) (97 . -55) (-1 . -55)) ((97 . -301) (-1 . -301)) ((97 .
- -300) (-1 . -300)) ((97 . -299) (-1 . -299)) ((97 . -298) (-1 . -298)) ((
- 97 . -297) (-1 . -297)) ((97 . -296) (-1 . -296)) ((65 . 107) (97 . -57) (
- -1 . -57)) ((64 . 106) (97 . -59) (-1 . -59)) ((8 . 105) (97 . -3) (-1 .
- -3)) ((97 . -2) (-1 . -2)) ((97 . -1) (-1 . -1)) ((63 . 104) (97 . -61) (
- -1 . -61)) ((-1 . -32)) ((-1 . -31)) ((-1 . -30)) ((-1 . -29)) ((-1 . -28)
- ) ((-1 . -27)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6
- ) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14)
- (158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21
- ) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28)
- (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35)
- (172 . 36) (178 . 66) (22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (
- 32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40
- . 79) (24 . 80) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140
- . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (43 . 92) (44
- . 93) (45 . 94) (46 . 95) (47 . 96) (147 . 97) (148 . 98) (149 . 99) (150
- . 100) (170 . 101) (133 . 102) (174 . 103)) ((97 . -5) (-1 . -5)) ((61 .
- 64) (62 . 65) (97 . -63) (-1 . -63)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6
- . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78
- . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 .
- 31) (87 . 32) (176 . 33) (168 . 62) (93 . 63)) ((8 . 8) (3 . 9) (4 . 10) (
- 5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77
- . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 .
- 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 61)) ((8 .
- 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181
- . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 57
- ) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 59
- )) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 .
- 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25)
- (93 . 57) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33)
- (168 . 58)) ((91 . 51) (93 . 52) (89 . 53) (88 . 54) (87 . 55) (86 . 56) (
- 97 . -21) (-1 . -21)) ((49 . 39) (50 . 40) (51 . 41) (52 . 42) (53 . 43) (
- 54 . 44) (55 . 45) (56 . 46) (57 . 47) (58 . 48) (59 . 49) (154 . 50) (97
- . -33) (-1 . -33)) ((97 . -65) (-1 . -65)) ((97 . -78) (-1 . -78)) ((83 .
- 38) (97 . 0)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6)
- (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14)
- (158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21)
- (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (
- 82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (
- 172 . 190)) ((-1 . -77)) ((-1 . -76)) ((-1 . -75)) ((-1 . -74)) ((-1 . -73
- )) ((-1 . -72)) ((-1 . -71)) ((-1 . -70)) ((-1 . -69)) ((-1 . -68)) ((-1
- . -67)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160
- . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (158
- . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21) (78
- . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (82 .
- 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (172
- . 189)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160
- . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (158
- . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21) (78
- . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (82 .
- 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (172
- . 36) (178 . 188)) ((92 . 183) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (
- 162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7
- . 13) (159 . 14) (22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 .
- 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79)
- (158 . 15) (179 . 16) (180 . 17) (181 . 18) (24 . 80) (25 . 81) (26 . 82)
- (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89)
- (143 . 90) (42 . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (
- 157 . 19) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93
- . 26) (177 . 27) (147 . 97) (148 . 146) (149 . 147) (150 . 100) (156 . 28)
- (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35)
- (170 . 184) (171 . 185) (172 . 186) (175 . 187)) ((6 . 12) (7 . 13) (181
- . 182)) ((6 . 12) (7 . 13) (181 . 181)) ((97 . -11) (-1 . -11)) ((97 . -12
- ) (-1 . -12)) ((22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72)
- (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (24
- . 80) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141
- . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (43 . 92) (44 . 93) (45
- . 94) (46 . 95) (47 . 96) (147 . 97) (148 . 98) (149 . 99) (150 . 100) (
- 170 . 101) (133 . 102) (174 . 180) (166 . 1) (165 . 2) (164 . 3) (163 . 4)
- (162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12)
- (7 . 13) (159 . 14) (158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19)
- (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (
- 177 . 27) (156 . 28) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 168 . 34) (155 . 35) (172 . 36) (178 . 66)) ((97 . -22) (-1 . -22)) ((97
- . -23) (-1 . -23)) ((97 . -33) (-1 . -33)) ((97 . -24) (-1 . -24)) ((97 .
- -25) (-1 . -25)) ((22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 .
- 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79)
- (24 . 80) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (
- 141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (43 . 92) (44 . 93) (
- 45 . 94) (46 . 95) (47 . 96) (147 . 97) (148 . 98) (149 . 99) (150 . 100)
- (170 . 101) (133 . 102) (174 . 179) (166 . 1) (165 . 2) (164 . 3) (163 . 4
- ) (162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12)
- (7 . 13) (159 . 14) (158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19
- ) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (
- 177 . 27) (156 . 28) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 168 . 34) (155 . 35) (172 . 36) (178 . 66)) ((166 . 1) (165 . 2) (164 . 3)
- (163 . 4) (162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11)
- (6 . 12) (7 . 13) (159 . 14) (158 . 15) (179 . 16) (180 . 17) (181 . 18)
- (157 . 19) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93
- . 26) (177 . 27) (156 . 28) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176
- . 33) (168 . 34) (155 . 35) (172 . 36) (178 . 178)) ((8 . 8) (3 . 9) (4
- . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20
- ) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (
- 167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 1) (
- 165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160 . 7) (159 . 14) (158
- . 15) (157 . 177)) ((92 . 176) (83 . 38)) ((-1 . -233)) ((85 . 174) (6 .
- 12) (7 . 13) (22 . 67) (138 . 169) (181 . 170) (137 . 175)) ((85 . 172) (6
- . 12) (7 . 13) (22 . 67) (138 . 169) (181 . 170) (137 . 173)) ((85 . 168)
- (6 . 12) (7 . 13) (22 . 67) (138 . 169) (181 . 170) (137 . 171)) ((-1 .
- -138)) ((31 . 167) (-1 . -136)) ((31 . 166) (-1 . -135)) ((-1 . -132)) ((
- 40 . 162) (38 . 163) (36 . 164) (34 . 165) (-1 . -127)) ((38 . 159) (36 .
- 160) (32 . 161) (-1 . -116)) ((-1 . -113)) ((40 . 155) (38 . 156) (36 .
- 157) (34 . 158) (-1 . -114)) ((38 . 154) (-1 . -109)) ((-1 . -176)) ((-1
- . -175)) ((-1 . -174)) ((-1 . -173)) ((-1 . -108)) ((-1 . -107)) ((-1 .
- -106)) ((-1 . -105)) ((-1 . -104)) ((-1 . -103)) ((-1 . -102)) ((-1 . -101
- )) ((-1 . -100)) ((-1 . -99)) ((-1 . -98)) ((-1 . -97)) ((-1 . -96)) ((22
- . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74
- ) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (24 . 80) (25 . 81) (
- 26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (
- 142 . 89) (143 . 90) (42 . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47
- . 96) (147 . 97) (148 . 146) (149 . 147) (150 . 100) (170 . 153) (-1 .
- -90)) ((24 . 80) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (147 .
- 97) (150 . 100) (170 . 151) (22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 .
- 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78)
- (40 . 79) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (
- 141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (148 . 98) (149 . 99)
- (133 . 152) (92 . -88) (80 . -158) (91 . -158) (93 . -158)) ((24 . 80) (43
- . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (147 . 97) (150 . 100) (170
- . 149) (22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33 .
- 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (25 . 81)
- (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88)
- (142 . 89) (143 . 90) (42 . 91) (148 . 98) (149 . 99) (133 . 150) (92 .
- -86) (80 . -156) (91 . -156) (93 . -156)) ((22 . 67) (28 . 68) (29 . 69) (
- 30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38
- . 77) (37 . 78) (40 . 79) (24 . 80) (25 . 81) (26 . 82) (27 . 83) (138 .
- 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42
- . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (147 . 97) (148 .
- 146) (149 . 147) (150 . 100) (170 . 148) (-1 . -84)) ((92 . -208)) ((91 .
- 140) (93 . 141) (80 . 142) (120 . 143) (127 . 144) (169 . 145)) ((92 . 139
- )) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 .
- 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25)
- (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26)
- (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (
- 160 . 7) (159 . 14) (158 . 138)) ((97 . -302) (-1 . -302)) ((8 . 8) (3 . 9
- ) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76
- . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 .
- 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 .
- 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160 . 7) (159 . 137)
- ) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 .
- 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25)
- (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26)
- (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (
- 160 . 136)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16
- ) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24)
- (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 93 . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161
- . 135)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (
- 180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81
- . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93
- . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 134)) ((8
- . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (
- 181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177
- . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168
- . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 133)) ((8 . 8) (3 . 9
- ) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76
- . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 .
- 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 .
- 1) (165 . 2) (164 . 3) (163 . 132)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6
- . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 .
- 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31
- ) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 3)
- (163 . 131)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 .
- 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24
- ) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33)
- (93 . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 130)) ((8 . 8)
- (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 .
- 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27)
- (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60)
- (166 . 1) (165 . 2) (164 . 3) (163 . 129)) ((8 . 8) (3 . 9) (4 . 10) (5 .
- 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21)
- (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (
- 86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 1) (165 . 2) (
- 164 . 128)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16
- ) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24)
- (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 93 . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 127)) ((8 . 8) (3 . 9) (4
- . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20
- ) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (
- 167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 1) (
- 165 . 126)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16
- ) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24)
- (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 93 . 26) (168 . 60) (166 . 1) (165 . 125)) ((8 . 8) (3 . 9) (4 . 10) (5 .
- 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21)
- (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (
- 86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (166 . 124)) ((8 . 8) (
- 3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18
- ) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (
- 82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (
- 166 . 123)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16
- ) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24)
- (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (
- 93 . 26) (168 . 60) (166 . 122)) ((97 . -38) (-1 . -38)) ((97 . -37) (-1
- . -37)) ((97 . -36) (-1 . -36)) ((80 . 119) (75 . 120) (74 . 121) (97 .
- -41) (-1 . -41)) ((80 . 119) (75 . 120) (74 . 121) (97 . -40) (-1 . -40))
- ((79 . 117) (78 . 118) (97 . -44) (-1 . -44)) ((79 . 117) (78 . 118) (97
- . -43) (-1 . -43)) ((73 . 115) (72 . 116) (97 . -49) (-1 . -49)) ((73 .
- 115) (72 . 116) (97 . -48) (-1 . -48)) ((73 . 115) (72 . 116) (97 . -47) (
- -1 . -47)) ((73 . 115) (72 . 116) (97 . -46) (-1 . -46)) ((71 . 111) (70
- . 112) (69 . 113) (68 . 114) (97 . -52) (-1 . -52)) ((71 . 111) (70 . 112)
- (69 . 113) (68 . 114) (97 . -51) (-1 . -51)) ((67 . 109) (66 . 110) (97
- . -54) (-1 . -54)) ((81 . 108) (97 . -56) (-1 . -56)) ((65 . 107) (97 .
- -58) (-1 . -58)) ((64 . 106) (97 . -60) (-1 . -60)) ((85 . 237) (8 . 8) (3
- . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (179 . 16) (180 . 17) (181 . 18)
- (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (177 . 27) (
- 82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (93 . 26) (168 . 60) (
- 166 . 238)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (
- 160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (
- 158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21)
- (78 . 22) (79 . 23) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (82 . 29) (
- 167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (172 . 232)
- (90 . 233) (44 . 234) (25 . 81) (26 . 82) (27 . 83) (148 . 223) (125 .
- 235) (80 . 236)) ((91 . 140) (93 . 141) (80 . 142) (120 . 143) (127 . 144)
- (169 . 226) (22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (
- 33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (24
- . 80) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141
- . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (43 . 92) (44 . 93) (45 .
- 94) (46 . 95) (47 . 96) (147 . 97) (148 . 146) (149 . 147) (150 . 100) (
- 170 . 227) (121 . 228) (122 . 229) (124 . 230) (92 . 231)) ((25 . 81) (26
- . 82) (27 . 83) (148 . 223) (125 . 224) (80 . 142) (127 . 225) (-1 . -193)
- ) ((91 . 221) (93 . 222) (92 . -211) (83 . -211)) ((91 . 140) (93 . 141) (
- 120 . 220) (92 . -209) (83 . -209)) ((92 . -207)) ((22 . 67) (28 . 68) (29
- . 69) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 .
- 76) (38 . 77) (37 . 78) (40 . 79) (24 . 80) (25 . 81) (26 . 82) (27 . 83)
- (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90
- ) (42 . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (147 . 97) (
- 148 . 146) (149 . 147) (150 . 100) (170 . 151) (-1 . -88)) ((22 . 67) (28
- . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75
- ) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (24 . 80) (25 . 81) (26 . 82) (
- 27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89)
- (143 . 90) (42 . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (
- 147 . 97) (148 . 146) (149 . 147) (150 . 100) (170 . 149) (-1 . -86)) ((-1
- . -85)) ((-1 . -87)) ((-1 . -155)) ((-1 . -89)) ((-1 . -157)) ((-1 . -91)
- ) ((-1 . -110)) ((38 . 219) (-1 . -111)) ((-1 . -115)) ((36 . 217) (38 .
- 218) (-1 . -118)) ((-1 . -133)) ((-1 . -117)) ((38 . 216) (-1 . -120)) ((
- 31 . 215) (-1 . -137)) ((38 . 214) (-1 . -125)) ((-1 . -126)) ((36 . 212)
- (38 . 213) (-1 . -129)) ((-1 . -134)) ((-1 . -139)) ((-1 . -140)) ((22 .
- 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74)
- (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (27
- . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (
- 143 . 90) (42 . 91) (148 . 203) (149 . 204) (95 . 205) (133 . 206) (134 .
- 207) (135 . 208) (136 . 211)) ((-1 . -149)) ((-1 . -148)) ((85 . 210) (-1
- . -144)) ((22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33
- . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (25 . 81
- ) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88
- ) (142 . 89) (143 . 90) (42 . 91) (148 . 203) (149 . 204) (95 . 205) (133
- . 206) (134 . 207) (135 . 208) (136 . 209)) ((85 . 202) (-1 . -147)) ((6
- . 12) (7 . 13) (181 . 199) (128 . 200) (129 . 201)) ((85 . 198) (-1 . -168
- )) ((97 . -4) (-1 . -4)) ((63 . 104) (97 . -62) (-1 . -62)) ((60 . 197) (
- 83 . 38)) ((92 . 196)) ((92 . 195)) ((97 . -10) (-1 . -10)) ((97 . -9) (-1
- . -9)) ((97 . -8) (-1 . -8)) ((91 . 140) (93 . 141) (80 . 142) (120 . 143
- ) (127 . 144) (169 . 194) (92 . -20) (83 . -20)) ((92 . -17) (83 . -17)) (
- (92 . -15) (83 . -15)) ((92 . 192) (83 . 193)) ((90 . 191) (83 . 38)) ((97
- . -66) (-1 . -66)) ((97 . -79) (-1 . -79)) ((97 . -6) (-1 . -6)) ((97 .
- -7) (-1 . -7)) ((22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72
- ) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (
- 24 . 80) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (
- 141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (43 . 92) (44 . 93) (
- 45 . 94) (46 . 95) (47 . 96) (147 . 97) (148 . 146) (149 . 147) (150 . 100
- ) (170 . 184) (171 . 291) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5
- ) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13)
- (159 . 14) (158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20
- ) (77 . 21) (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (
- 156 . 28) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (176 . 33) (168 . 34) (
- 155 . 35) (172 . 292)) ((92 . -19) (83 . -19)) ((85 . 237)) ((85 . 237) (
- 97 . -26) (-1 . -26)) ((8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13)
- (179 . 16) (180 . 17) (181 . 18) (76 . 20) (77 . 21) (78 . 22) (79 . 23)
- (80 . 24) (81 . 25) (177 . 27) (82 . 29) (167 . 30) (86 . 31) (87 . 32) (
- 176 . 33) (93 . 26) (168 . 60) (166 . 1) (165 . 2) (164 . 3) (163 . 4) (
- 162 . 5) (161 . 6) (160 . 7) (159 . 14) (158 . 15) (157 . 19) (156 . 28) (
- 155 . 290)) ((6 . 12) (7 . 13) (181 . 199) (128 . 200) (129 . 289)) ((59
- . 288) (84 . -171) (83 . -171)) ((84 . -169) (83 . -169)) ((84 . 286) (83
- . 287)) ((22 . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33
- . 73) (34 . 74) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (25 . 81
- ) (26 . 82) (27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88
- ) (142 . 89) (143 . 90) (42 . 91) (148 . 203) (149 . 204) (95 . 205) (133
- . 206) (134 . 207) (135 . 208) (136 . 285)) ((22 . 67) (28 . 68) (29 . 69)
- (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38
- . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139
- . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (148
- . 203) (149 . 204) (133 . 152) (-1 . -158)) ((22 . 67) (28 . 68) (29 . 69
- ) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (
- 38 . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139
- . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (
- 148 . 203) (149 . 204) (133 . 150) (-1 . -156)) ((95 . -304) (-1 . -304))
- ((6 . 12) (7 . 13) (80 . 142) (93 . 279) (181 . 257) (126 . 258) (127 .
- 280) (60 . 281) (145 . 282) (131 . 283) (132 . 284)) ((95 . -151) (-1 .
- -151)) ((95 . -150) (-1 . -150)) ((84 . 278) (22 . 67) (28 . 68) (29 . 69)
- (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38
- . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139
- . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (148
- . 203) (149 . 204) (133 . 206) (135 . 275) (95 . 205) (134 . 276)) ((22
- . 67) (28 . 68) (29 . 69) (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74
- ) (35 . 75) (36 . 76) (38 . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (
- 27 . 83) (138 . 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89)
- (143 . 90) (42 . 91) (148 . 203) (149 . 204) (95 . 205) (133 . 206) (134
- . 207) (135 . 208) (136 . 277)) ((84 . 274) (22 . 67) (28 . 68) (29 . 69)
- (30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38
- . 77) (37 . 78) (40 . 79) (25 . 81) (26 . 82) (27 . 83) (138 . 84) (139 .
- 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42 . 91) (148
- . 203) (149 . 204) (133 . 206) (135 . 275) (95 . 205) (134 . 276)) ((38 .
- 273) (-1 . -131)) ((-1 . -128)) ((-1 . -124)) ((-1 . -141)) ((-1 . -121))
- ((38 . 272) (-1 . -122)) ((-1 . -119)) ((-1 . -112)) ((91 . 221) (93 . 222
- ) (92 . -210) (83 . -210)) ((44 . 267) (90 . 268) (166 . 1) (165 . 2) (164
- . 3) (163 . 4) (162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9) (4 . 10) (5
- . 11) (6 . 12) (7 . 13) (159 . 14) (158 . 15) (179 . 16) (180 . 17) (181
- . 18) (157 . 19) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80 . 269) (81 .
- 25) (93 . 26) (177 . 27) (156 . 28) (82 . 29) (167 . 30) (86 . 31) (87 .
- 32) (176 . 33) (168 . 34) (155 . 35) (172 . 270) (25 . 81) (26 . 82) (27
- . 83) (148 . 223) (125 . 271)) ((92 . 265) (22 . 67) (28 . 68) (29 . 69) (
- 30 . 70) (31 . 71) (32 . 72) (33 . 73) (34 . 74) (35 . 75) (36 . 76) (38
- . 77) (37 . 78) (40 . 79) (24 . 80) (25 . 81) (26 . 82) (27 . 83) (138 .
- 84) (139 . 85) (140 . 86) (141 . 87) (41 . 88) (142 . 89) (143 . 90) (42
- . 91) (43 . 92) (44 . 93) (45 . 94) (46 . 95) (47 . 96) (147 . 97) (148 .
- 146) (149 . 147) (150 . 100) (170 . 227) (121 . 228) (122 . 229) (124 .
- 266)) ((-1 . -196)) ((80 . 142) (127 . 264) (25 . 81) (26 . 82) (27 . 83)
- (148 . 250) (-1 . -192)) ((-1 . -195)) ((92 . 263)) ((6 . 12) (7 . 13) (
- 181 . 257) (126 . 258) (145 . 259) (91 . 140) (93 . 260) (80 . 142) (120
- . 143) (127 . 261) (169 . 262) (92 . -204) (83 . -204)) ((83 . -200) (92
- . -200)) ((83 . 256) (92 . -198)) ((92 . 255)) ((-1 . -232)) ((90 . 254))
- ((-1 . -223)) ((25 . 81) (26 . 82) (27 . 83) (148 . 223) (125 . 253)) ((44
- . 249) (25 . 81) (26 . 82) (27 . 83) (148 . 250) (90 . 251) (166 . 1) (
- 165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (160 . 7) (8 . 8) (3 . 9)
- (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (158 . 15) (179 . 16) (180
- . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21) (78 . 22) (79 . 23) (80
- . 24) (81 . 25) (93 . 26) (177 . 27) (156 . 28) (82 . 29) (167 . 30) (86
- . 31) (87 . 32) (176 . 33) (168 . 34) (155 . 35) (172 . 252)) ((90 . 248)
- (-1 . -28)) ((166 . 1) (165 . 2) (164 . 3) (163 . 4) (162 . 5) (161 . 6) (
- 160 . 7) (8 . 8) (3 . 9) (4 . 10) (5 . 11) (6 . 12) (7 . 13) (159 . 14) (
- 158 . 15) (179 . 16) (180 . 17) (181 . 18) (157 . 19) (76 . 20) (77 . 21)
- (78 . 22) (79 . 23) (80 . 24) (81 . 25) (93 . 26) (177 . 27) (89 . 239) (
- 91 . 240) (156 . 28) (82 . 29) (167 . 30) (86&nb