From b689315686047c99badae9553a754f5218b2643e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 8 Apr 2016 18:29:54 -0700 Subject: [PATCH] delete duplicate --- br-bf copy/bf-test-sexp.rkt | 2 -- br-bf copy/bf-test.rkt | 2 -- br-bf copy/expander.rkt | 23 ----------------------- br-bf copy/fib.rkt | 12 ------------ br-bf copy/hello-world.rkt | 6 ------ br-bf copy/info.rkt | 3 --- br-bf copy/main.rkt | 12 ------------ br-bf copy/parser-test.rkt | 4 ---- br-bf copy/parser.rkt | 20 -------------------- br-bf copy/reader.rkt | 10 ---------- br-bf copy/tokenizer.rkt | 15 --------------- 11 files changed, 109 deletions(-) delete mode 100644 br-bf copy/bf-test-sexp.rkt delete mode 100644 br-bf copy/bf-test.rkt delete mode 100644 br-bf copy/expander.rkt delete mode 100644 br-bf copy/fib.rkt delete mode 100644 br-bf copy/hello-world.rkt delete mode 100644 br-bf copy/info.rkt delete mode 100644 br-bf copy/main.rkt delete mode 100644 br-bf copy/parser-test.rkt delete mode 100644 br-bf copy/parser.rkt delete mode 100644 br-bf copy/reader.rkt delete mode 100644 br-bf copy/tokenizer.rkt diff --git a/br-bf copy/bf-test-sexp.rkt b/br-bf copy/bf-test-sexp.rkt deleted file mode 100644 index c161b67..0000000 --- a/br-bf copy/bf-test-sexp.rkt +++ /dev/null @@ -1,2 +0,0 @@ -#lang s-exp br-bf/expander -(bf-program (op "+") (op "+") (op "+") (op "+") (op "+") (op "+") (op "+") (loop "[" (op ">") (op "+") (op "+") (op "+") (op "+") (op "+") (op "<") (op "-") "]") (op ">") (op ".")) \ No newline at end of file diff --git a/br-bf copy/bf-test.rkt b/br-bf copy/bf-test.rkt deleted file mode 100644 index 2281219..0000000 --- a/br-bf copy/bf-test.rkt +++ /dev/null @@ -1,2 +0,0 @@ -#lang br-bf -+++++++[>+++++<-]>. diff --git a/br-bf copy/expander.rkt b/br-bf copy/expander.rkt deleted file mode 100644 index 8e8cf24..0000000 --- a/br-bf copy/expander.rkt +++ /dev/null @@ -1,23 +0,0 @@ -#lang br -(provide #%module-begin #%top-interaction bf-program op loop) - -(define #'(bf-program ...) - #'(begin ...)) - -(define-cases #'op - [#'(_ ">") #'(move-pointer 1)] - [#'(_ "<") #'(move-pointer -1)] - [#'(_ "+") #'(set-pointer-byte! (add1 (get-pointer-byte)))] - [#'(_ "-") #'(set-pointer-byte! (sub1 (get-pointer-byte)))] - [#'(_ ".") #'(write-byte (get-pointer-byte))] - [#'(_ ",") #'(set-pointer-byte! (read-byte))]) - -(define #'(loop "[" ... "]") - #'(until (zero? (get-pointer-byte)) - ...)) - -(define bf-vector (make-vector 1000 0)) -(define bf-pointer 0) -(define (get-pointer-byte) (vector-ref bf-vector bf-pointer)) -(define (set-pointer-byte! val) (vector-set! bf-vector bf-pointer val)) -(define (move-pointer how-far) (set! bf-pointer (+ bf-pointer how-far))) \ No newline at end of file diff --git a/br-bf copy/fib.rkt b/br-bf copy/fib.rkt deleted file mode 100644 index b1e61dc..0000000 --- a/br-bf copy/fib.rkt +++ /dev/null @@ -1,12 +0,0 @@ -#lang br-bf -+++++++++++ ->+>>>>++++++++++++++++++++++++++++++++++++++++++++ ->++++++++++++++++++++++++++++++++<<<<<<[>[>>>>>>+> -+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-]<[>++++++++++[- -<-[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]]>[<<[>>>+<<< --]>>[-]]<<]>>>[>>+>+<<<-]>>>[<<<+>>>-]+<[>[-]<[-]] ->[<<+>>[-]]<<<<<<<]>>>>>[+++++++++++++++++++++++++ -+++++++++++++++++++++++.[-]]++++++++++<[->-<]>++++ -++++++++++++++++++++++++++++++++++++++++++++.[-]<< -<<<<<<<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<-[>>.>.<<< -[-]]<<[>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<-] \ No newline at end of file diff --git a/br-bf copy/hello-world.rkt b/br-bf copy/hello-world.rkt deleted file mode 100644 index b40875c..0000000 --- a/br-bf copy/hello-world.rkt +++ /dev/null @@ -1,6 +0,0 @@ -#lang br-bf -++++++[>++++++++++++<-]>. ->++++++++++[>++++++++++<-]>+. -+++++++..+++.>++++[>+++++++++++<-]>. -<+++[>----<-]>.<<<<<+++[>+++++<-]>. ->>.+++.------.--------.>>+. \ No newline at end of file diff --git a/br-bf copy/info.rkt b/br-bf copy/info.rkt deleted file mode 100644 index 2df8ff5..0000000 --- a/br-bf copy/info.rkt +++ /dev/null @@ -1,3 +0,0 @@ -#lang info - -(define compile-omit-paths 'all) \ No newline at end of file diff --git a/br-bf copy/main.rkt b/br-bf copy/main.rkt deleted file mode 100644 index 778f492..0000000 --- a/br-bf copy/main.rkt +++ /dev/null @@ -1,12 +0,0 @@ -#lang br - -(module reader br - (require "tokenizer.rkt" "parser.rkt" syntax/strip-context) - (provide read-syntax) - (define (read-syntax src-path src-port) - (define parsed-stx (parse src-path (tokenize src-port))) - (define new-ctxt-stx (datum->syntax #f 'new-ctxt)) - (inject-syntax ([#'src-stx (replace-context new-ctxt-stx parsed-stx)]) - #'(module bf-interpreter br-bf/expander - src-stx)))) - \ No newline at end of file diff --git a/br-bf copy/parser-test.rkt b/br-bf copy/parser-test.rkt deleted file mode 100644 index 4325329..0000000 --- a/br-bf copy/parser-test.rkt +++ /dev/null @@ -1,4 +0,0 @@ -#lang racket -(require "tokenizer.rkt" "parser.rkt" ragg/support) - -(syntax->datum (parse (tokenize (open-input-string "[+-]>")))) \ No newline at end of file diff --git a/br-bf copy/parser.rkt b/br-bf copy/parser.rkt deleted file mode 100644 index ab562b4..0000000 --- a/br-bf copy/parser.rkt +++ /dev/null @@ -1,20 +0,0 @@ -#lang ragg -;; use uppercase TOKEN-IDENTIFIERS for classes of tokens -;; too numerous to indicate individually -;; (e.g., numbers, strings) - -bf-program : (op | loop)* -op : ">" | "<" | "+" | "-" | "." | "," -loop : "[" (op | loop)* "]" - - -;; Alternate ways of specifying grammar -;; bf-program : op* -;; op : ">" | "<" | "+" | "-" | "." | "," | loop -;; loop : "[" op* "]" - -;; bf-program : expr* -;; expr : op | loop -;; op : ">" | "<" | "+" | "-" | "." | "," -;; loop : "[" bf-program "]" - diff --git a/br-bf copy/reader.rkt b/br-bf copy/reader.rkt deleted file mode 100644 index b80844d..0000000 --- a/br-bf copy/reader.rkt +++ /dev/null @@ -1,10 +0,0 @@ -#lang ragg - - : ">" - | "<" - | "+" - | "-" - | "." - | "," - | - : "["*"]" \ No newline at end of file diff --git a/br-bf copy/tokenizer.rkt b/br-bf copy/tokenizer.rkt deleted file mode 100644 index ceb0c83..0000000 --- a/br-bf copy/tokenizer.rkt +++ /dev/null @@ -1,15 +0,0 @@ -#lang racket/base -(require parser-tools/lex ragg/support) -(provide tokenize) - -(define (tokenize ip) - (port-count-lines! ip) - - (define lex - (lexer - [(char-set "><-.,+[]") lexeme] - [whitespace (token 'white #:skip? #t)] - [(eof) (void)])) - - (define next-token-func (λ _ (lex ip))) - next-token-func)