".ss" -> ".rkt" scan done.

original commit: 3157955d40f89d83fb3d5fa7a2f20639cda69579
tokens
Eli Barzilay 13 years ago
parent 57a7231b45
commit 509800c0df

@ -59,7 +59,7 @@
[comment (:: #\; (:* (:~ #\newline)) #\newline)] [comment (:: #\; (:* (:~ #\newline)) #\newline)]
;; See ${PLTHOME}/collects/syntax-color/scheme-lexer.ss for an example of ;; See ${PLTHOME}/collects/syntax-color/scheme-lexer.rkt for an example of
;; using regexp macros to avoid the cut and paste. ;; using regexp macros to avoid the cut and paste.
; [numR (:: prefixR complexR)] ; [numR (:: prefixR complexR)]
; [complexR (:or realR ; [complexR (:or realR

@ -2,19 +2,19 @@
;; Provides the syntax used to create lexers and the functions needed to ;; Provides the syntax used to create lexers and the functions needed to
;; create and use the buffer that the lexer reads from. See docs. ;; create and use the buffer that the lexer reads from. See docs.
(require-for-syntax mzlib/list (require-for-syntax mzlib/list
syntax/stx syntax/stx
syntax/define syntax/define
syntax/boundmap syntax/boundmap
"private-lex/util.ss" "private-lex/util.rkt"
"private-lex/actions.ss" "private-lex/actions.rkt"
"private-lex/front.ss" "private-lex/front.rkt"
"private-lex/unicode-chars.ss") "private-lex/unicode-chars.rkt")
(require mzlib/stxparam (require mzlib/stxparam
syntax/readerr syntax/readerr
"private-lex/token.ss") "private-lex/token.rkt")
(provide lexer lexer-src-pos define-lex-abbrev define-lex-abbrevs define-lex-trans (provide lexer lexer-src-pos define-lex-abbrev define-lex-abbrevs define-lex-trans

@ -2,8 +2,8 @@
(require mzlib/list (require mzlib/list
(prefix is: mzlib/integer-set) (prefix is: mzlib/integer-set)
"re.ss" "re.rkt"
"util.ss") "util.rkt")
(provide build-dfa print-dfa (struct dfa (num-states start-state final-states/actions transitions))) (provide build-dfa print-dfa (struct dfa (num-states start-state final-states/actions transitions)))

@ -1,6 +1,6 @@
#lang scheme/base #lang scheme/base
(require (for-syntax scheme/base) (require (for-syntax scheme/base)
"../lex.ss" "../lex.rkt"
rackunit) rackunit)
(define-syntax (catch-syn-error stx) (define-syntax (catch-syn-error stx)

@ -1,11 +1,11 @@
(module front mzscheme (module front mzscheme
(require (prefix is: mzlib/integer-set) (require (prefix is: mzlib/integer-set)
mzlib/list mzlib/list
syntax/stx syntax/stx
"util.ss" "util.rkt"
"stx.ss" "stx.rkt"
"re.ss" "re.rkt"
"deriv.ss") "deriv.rkt")
(provide build-lexer) (provide build-lexer)

@ -2,7 +2,7 @@
(require mzlib/list (require mzlib/list
scheme/match scheme/match
(prefix is: mzlib/integer-set) (prefix is: mzlib/integer-set)
"util.ss") "util.rkt")
(provide ->re build-epsilon build-zero build-char-set build-concat (provide ->re build-epsilon build-zero build-char-set build-concat
build-repeat build-or build-and build-neg build-repeat build-or build-and build-neg

@ -1,6 +1,6 @@
(module stx mzscheme (module stx mzscheme
(require syntax/boundmap (require syntax/boundmap
"util.ss") "util.rkt")
(provide parse) (provide parse)
@ -32,7 +32,7 @@
(define (disarm stx) (define (disarm stx)
(syntax-disarm stx orig-insp)) (syntax-disarm stx orig-insp))
;; parse : syntax-object (box (list-of syntax-object)) -> s-re (see re.ss) ;; parse : syntax-object (box (list-of syntax-object)) -> s-re (see re.rkt)
;; checks for errors and generates the plain s-exp form for s ;; checks for errors and generates the plain s-exp form for s
;; Expands lex-abbrevs and applies lex-trans. ;; Expands lex-abbrevs and applies lex-trans.
(define (parse stx disappeared-uses) (define (parse stx disappeared-uses)

@ -1,6 +1,6 @@
(module token mzscheme (module token mzscheme
(require-for-syntax "token-syntax.ss") (require-for-syntax "token-syntax.rkt")
;; Defining tokens ;; Defining tokens

@ -1,5 +1,5 @@
(module unicode-chars mzscheme (module unicode-chars mzscheme
(require "util.ss") (require "util.rkt")
(provide (all-defined)) (provide (all-defined))

@ -5,7 +5,7 @@
(require mzlib/class (require mzlib/class
mzlib/list mzlib/list
"yacc-helper.ss" "yacc-helper.rkt"
mzlib/contract) mzlib/contract)
;; Each production has a unique index 0 <= index <= number of productions ;; Each production has a unique index 0 <= index <= number of productions

@ -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))))

@ -1,11 +1,11 @@
(module lalr mzscheme (module lalr mzscheme
;; Compute LALR lookaheads from DeRemer and Pennello 1982 ;; Compute LALR lookaheads from DeRemer and Pennello 1982
(require "lr0.ss" (require "lr0.rkt"
"grammar.ss" "grammar.rkt"
mzlib/list mzlib/list
mzlib/class) mzlib/class)
(provide compute-LA) (provide compute-LA)
@ -228,7 +228,7 @@
;; -> (trans-key -> term list) ;; -> (trans-key -> term list)
;; DeRemer and Pennello 1982 ;; DeRemer and Pennello 1982
;; Computes (f x) = (f- x) union Union{(f y) | y in (edges x)} ;; Computes (f x) = (f- x) union Union{(f y) | y in (edges x)}
;; A specialization of digraph in the file graph.ss ;; A specialization of digraph in the file graph.rkt
(define (digraph-tk->terml nodes edges f- num-states) (define (digraph-tk->terml nodes edges f- num-states)
(letrec ( (letrec (
;; Will map elements of trans-key to term sets represented as bit vectors ;; Will map elements of trans-key to term sets represented as bit vectors

@ -2,14 +2,14 @@
;; Handle the LR0 automaton ;; Handle the LR0 automaton
(require "grammar.ss" (require "grammar.rkt"
"graph.ss" "graph.rkt"
mzlib/list mzlib/list
mzlib/class) mzlib/class)
(provide build-lr0-automaton lr0% (provide build-lr0-automaton lr0%
(struct trans-key (st gs)) trans-key-list-remove-dups (struct trans-key (st gs)) trans-key-list-remove-dups
kernel-items kernel-index) kernel-items kernel-index)
;; kernel = (make-kernel (LR1-item list) index) ;; kernel = (make-kernel (LR1-item list) index)
;; the list must be kept sorted according to item<? so that equal? can ;; the list must be kept sorted according to item<? so that equal? can

@ -1,5 +1,5 @@
(module parser-actions mzscheme (module parser-actions mzscheme
(require "grammar.ss") (require "grammar.rkt")
(provide (all-defined-except make-reduce make-reduce*) (provide (all-defined-except make-reduce make-reduce*)
(rename make-reduce* make-reduce)) (rename make-reduce* make-reduce))

@ -1,8 +1,8 @@
(module parser-builder mzscheme (module parser-builder mzscheme
(require "input-file-parser.ss" (require "input-file-parser.rkt"
"grammar.ss" "grammar.rkt"
"table.ss" "table.rkt"
mzlib/class mzlib/class
mzlib/contract) mzlib/contract)
(require-for-template mzscheme) (require-for-template mzscheme)
@ -69,7 +69,7 @@
#`(when #f #`(when #f
(let ((bind void) ... (tmp void) ...) (let ((bind void) ... (tmp void) ...)
(void bound ... ... term-group ... start ... end ... prec ...)))))) (void bound ... ... term-group ... start ... end ... prec ...))))))
(require mzlib/list "parser-actions.ss") (require mzlib/list "parser-actions.rkt")
(define (build-parser filename src-pos suppress input-terms start end assocs prods) (define (build-parser filename src-pos suppress input-terms start end assocs prods)
(let* ((grammar (parse-input input-terms start end assocs prods src-pos)) (let* ((grammar (parse-input input-terms start end assocs prods src-pos))
(table (build-table grammar filename suppress)) (table (build-table grammar filename suppress))

@ -1,14 +1,14 @@
#lang scheme/base #lang scheme/base
;; Routine to build the LALR table ;; Routine to build the LALR table
(require "grammar.ss" (require "grammar.rkt"
"lr0.ss" "lr0.rkt"
"lalr.ss" "lalr.rkt"
"parser-actions.ss" "parser-actions.rkt"
mzlib/contract mzlib/contract
mzlib/list mzlib/list
mzlib/class) mzlib/class)
(provide/contract (provide/contract
(build-table ((is-a?/c grammar%) string? any/c . -> . (build-table ((is-a?/c grammar%) string? any/c . -> .

@ -1,8 +1,8 @@
(module yacc-helper mzscheme (module yacc-helper mzscheme
(require mzlib/list (require mzlib/list
"../private-lex/token-syntax.ss") "../private-lex/token-syntax.rkt")
;; General helper routines ;; General helper routines
(provide duplicate-list? remove-duplicates overlap? vector-andmap display-yacc) (provide duplicate-list? remove-duplicates overlap? vector-andmap display-yacc)

@ -1,19 +1,19 @@
#lang scheme/base #lang scheme/base
(require (for-syntax scheme/base (require (for-syntax scheme/base
"private-yacc/parser-builder.ss" "private-yacc/parser-builder.rkt"
"private-yacc/grammar.ss" "private-yacc/grammar.rkt"
"private-yacc/yacc-helper.ss" "private-yacc/yacc-helper.rkt"
"private-yacc/parser-actions.ss")) "private-yacc/parser-actions.rkt"))
(require "private-lex/token.ss" (require "private-lex/token.rkt"
"private-yacc/parser-actions.ss" "private-yacc/parser-actions.rkt"
mzlib/etc mzlib/etc
mzlib/pretty mzlib/pretty
syntax/readerr) syntax/readerr)
(provide parser) (provide parser)
;; convert-parse-table : (vectorof (listof (cons/c gram-sym? action?))) -> ;; convert-parse-table : (vectorof (listof (cons/c gram-sym? action?))) ->
;; (vectorof (symbol runtime-action hashtable)) ;; (vectorof (symbol runtime-action hashtable))
(define-for-syntax (convert-parse-table table) (define-for-syntax (convert-parse-table table)
@ -255,7 +255,7 @@
;; The table is a vector that maps each state to a hash-table that maps a ;; The table is a vector that maps each state to a hash-table that maps a
;; terminal symbol to either an accept, shift, reduce, or goto structure. ;; terminal symbol to either an accept, shift, reduce, or goto structure.
; We encode the structures according to the runtime-action data definition in ; We encode the structures according to the runtime-action data definition in
;; parser-actions.ss ;; parser-actions.rkt
(define (parser-body debug? err starts ends table all-term-syms actions src-pos) (define (parser-body debug? err starts ends table all-term-syms actions src-pos)
(local ((define extract (local ((define extract
(if src-pos (if src-pos

Loading…
Cancel
Save