|
|
@ -1,11 +1,11 @@
|
|
|
|
(module input-file-parser mzscheme
|
|
|
|
(module input-file-parser mzscheme
|
|
|
|
|
|
|
|
|
|
|
|
;; routines for parsing the input to the parser generator and producing a
|
|
|
|
;; routines for parsing the input to the parser generator and producing a
|
|
|
|
;; grammar (See grammar.ss)
|
|
|
|
;; grammar (See grammar.rkt)
|
|
|
|
|
|
|
|
|
|
|
|
(require "yacc-helper.ss"
|
|
|
|
(require "yacc-helper.rkt"
|
|
|
|
"../private-lex/token-syntax.ss"
|
|
|
|
"../private-lex/token-syntax.rkt"
|
|
|
|
"grammar.ss"
|
|
|
|
"grammar.rkt"
|
|
|
|
mzlib/class
|
|
|
|
mzlib/class
|
|
|
|
mzlib/contract)
|
|
|
|
mzlib/contract)
|
|
|
|
(require-for-template mzscheme)
|
|
|
|
(require-for-template mzscheme)
|
|
|
@ -57,7 +57,7 @@
|
|
|
|
(values args biggest-pos))))
|
|
|
|
(values args biggest-pos))))
|
|
|
|
|
|
|
|
|
|
|
|
;; Given the list of terminal symbols and the precedence/associativity definitions,
|
|
|
|
;; Given the list of terminal symbols and the precedence/associativity definitions,
|
|
|
|
;; builds terminal structures (See grammar.ss)
|
|
|
|
;; builds terminal structures (See grammar.rkt)
|
|
|
|
;; build-terms: symbol list * symbol list list -> term list
|
|
|
|
;; build-terms: symbol list * symbol list list -> term list
|
|
|
|
(define (build-terms term-list precs)
|
|
|
|
(define (build-terms term-list precs)
|
|
|
|
(let ((counter 0)
|
|
|
|
(let ((counter 0)
|
|
|
@ -87,7 +87,7 @@
|
|
|
|
(hash-table-get prec-table term-sym (lambda () #f))))
|
|
|
|
(hash-table-get prec-table term-sym (lambda () #f))))
|
|
|
|
term-list)))
|
|
|
|
term-list)))
|
|
|
|
|
|
|
|
|
|
|
|
;; Retrieves the terminal symbols from a terminals-def (See terminal-syntax.ss)
|
|
|
|
;; Retrieves the terminal symbols from a terminals-def (See terminal-syntax.rkt)
|
|
|
|
;; get-terms-from-def: identifier? -> (listof identifier?)
|
|
|
|
;; get-terms-from-def: identifier? -> (listof identifier?)
|
|
|
|
(define (get-terms-from-def term-syn)
|
|
|
|
(define (get-terms-from-def term-syn)
|
|
|
|
(let ((t (syntax-local-value term-syn (lambda () #f))))
|
|
|
|
(let ((t (syntax-local-value term-syn (lambda () #f))))
|
|
|
|