Skip to content
Browse files

renaming

  • Loading branch information...
1 parent 1dfb674 commit d20c6b5283f8c628c661d984a1e23a6c4612b06f Danny Yoo committed Jun 10, 2011
View
10 examples/README
@@ -0,0 +1,10 @@
+Here are some sample runs:
+
+
+$ racket hello-world.rkt
+Hello World!
+
+
+
+$ echo 10 | racket prime.rkt
+Primes up to: 2 3 5 7
View
11 examples/manual-hello-world.rkt
@@ -1,10 +1,10 @@
#lang racket/base
-(require "../lang/runtime.rkt")
+(require "../lang/semantics.rkt")
#|
A manual translation of the hello world program, just to make sure I
-have the right understanding of the evaluation.
+have the right understanding of the semantics. I hand-translate:
@@ -33,8 +33,13 @@ have the right understanding of the evaluation.
> . print '\n
+
+into the program below:
+
|#
+
+
(toplevel
(increment-byte)
@@ -137,4 +142,4 @@ have the right understanding of the evaluation.
(increment-data-pointer) (increment-byte) (output-byte)
;; > . print '\n
- (increment-data-pointer) (output-byte))
+ (increment-data-pointer) (output-byte))
View
222 examples/prime.rkt
@@ -0,0 +1,222 @@
+#lang planet dyoo/brainfudge
+===================================================================
+======================== OUTPUT STRING ============================
+===================================================================
+>++++++++[<++++++++>-]<++++++++++++++++.[-]
+>++++++++++[<++++++++++>-]<++++++++++++++.[-]
+>++++++++++[<++++++++++>-]<+++++.[-]
+>++++++++++[<++++++++++>-]<+++++++++.[-]
+>++++++++++[<++++++++++>-]<+.[-]
+>++++++++++[<++++++++++>-]<+++++++++++++++.[-]
+>+++++[<+++++>-]<+++++++.[-]
+>++++++++++[<++++++++++>-]<+++++++++++++++++.[-]
+>++++++++++[<++++++++++>-]<++++++++++++.[-]
+>+++++[<+++++>-]<+++++++.[-]
+>++++++++++[<++++++++++>-]<++++++++++++++++.[-]
+>++++++++++[<++++++++++>-]<+++++++++++.[-]
+>+++++++[<+++++++>-]<+++++++++.[-]
+>+++++[<+++++>-]<+++++++.[-]
+
+===================================================================
+======================== INPUT NUMBER ============================
+===================================================================
++ cont=1
+[
+ - cont=0
+ >,
+ ======SUB10======
+ ----------
+
+ [ not 10
+ <+> cont=1
+ =====SUB38======
+ ----------
+ ----------
+ ----------
+ --------
+
+ >
+ =====MUL10=======
+ [>+>+<<-]>>[<<+>>-]< dup
+
+ >>>+++++++++
+ [
+ <<<
+ [>+>+<<-]>>[<<+>>-]< dup
+ [<<+>>-]
+ >>-
+ ]
+ <<<[-]<
+ ======RMOVE1======
+ <
+ [>+<-]
+ ]
+ <
+]
+>>[<<+>>-]<<
+
+===================================================================
+======================= PROCESS NUMBER ===========================
+===================================================================
+
+==== ==== ==== ====
+numd numu teid teiu
+==== ==== ==== ====
+
+>+<-
+[
+ >+
+ ======DUP======
+ [>+>+<<-]>>[<<+>>-]<
+
+ >+<--
+
+ >>>>>>>>+<<<<<<<< isprime=1
+
+ [
+ >+
+
+ <-
+
+ =====DUP3=====
+ <[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<<<
+
+ =====DUP2=====
+ >[>>+>+<<<-]>>>[<<<+>>>-]<<< <
+
+
+ >>>
+
+
+ ====DIVIDES=======
+ [>+>+<<-]>>[<<+>>-]< DUP i=div
+
+ <<
+ [
+ >>>>>+ bool=1
+ <<<
+ [>+>+<<-]>>[<<+>>-]< DUP
+ [>>[-]<<-] IF i THEN bool=0
+ >>
+ [ IF i=0
+ <<<<
+ [>+>+<<-]>>[<<+>>-]< i=div
+ >>>
+ - bool=0
+ ]
+ <<<
+ - DEC i
+ <<
+ -
+ ]
+
+ +>>[<<[-]>>-]<<
+ >[-]< CLR div
+ =====END DIVIDES====
+
+
+ [>>>>>>[-]<<<<<<-] if divides then isprime=0
+
+
+ <<
+
+ >>[-]>[-]<<<
+ ]
+
+ >>>>>>>>
+ [
+ -
+ <<<<<<<[-]<<
+
+ [>>+>+<<<-]>>>[<<<+>>>-]<<<
+
+ >>
+
+
+
+
+ ===================================================================
+ ======================== OUTPUT NUMBER ===========================
+ ===================================================================
+ [>+<-]>
+
+ [
+ ======DUP======
+ [>+>+<<-]>>[<<+>>-]<
+
+
+ ======MOD10====
+ >+++++++++<
+ [
+ >>>+<< bool= 1
+ [>+>[-]<<-] bool= ten==0
+ >[<+>-] ten = tmp
+ >[<<++++++++++>>-] if ten=0 ten=10
+ <<- dec ten
+ <- dec num
+ ]
+ +++++++++ num=9
+ >[<->-]< dec num by ten
+
+ =======RROT======
+ [>+<-]
+ < [>+<-]
+ < [>+<-]
+ >>>[<<<+>>>-]
+ <
+
+ =======DIV10========
+ >+++++++++<
+ [
+ >>>+<< bool= 1
+ [>+>[-]<<-] bool= ten==0
+ >[<+>-] ten = tmp
+ >[<<++++++++++>>>+<-] if ten=0 ten=10 inc div
+ <<- dec ten
+ <- dec num
+ ]
+ >>>>[<<<<+>>>>-]<<<< copy div to num
+ >[-]< clear ten
+
+ =======INC1=========
+ <+>
+ ]
+
+ <
+ [
+ =======MOVER=========
+ [>+<-]
+
+ =======ADD48========
+ +++++++[<+++++++>-]<->
+
+ =======PUTC=======
+ <.[-]>
+
+ ======MOVEL2========
+ >[<<+>>-]<
+
+ <-
+ ]
+
+ >++++[<++++++++>-]<.[-]
+
+ ===================================================================
+ =========================== END FOR ===============================
+ ===================================================================
+
+
+ >>>>>>>
+ ]
+ <<<<<<<<
+
+
+
+ >[-]<
+ [-]
+ <<-
+]
+
+======LF========
+
+++++++++++.[-]
View
4 lang/lang.rkt
@@ -1,4 +0,0 @@
-#lang racket/base
-(require "runtime.rkt")
-(provide (all-from-out "runtime.rkt")
- (rename-out [#%plain-module-begin #%module-begin]))
View
4 lang/language.rkt
@@ -0,0 +1,4 @@
+#lang racket/base
+(require "semantics.rkt")
+(provide (all-from-out "semantics.rkt")
+ (rename-out [#%plain-module-begin #%module-begin]))
View
5 lang/reader.rkt
@@ -1,17 +1,16 @@
#lang s-exp syntax/module-reader
-(planet dyoo/brainfudge/lang/lang)
+(planet dyoo/brainfudge/lang/language)
#:read my-read
#:read-syntax my-read-syntax
-
;; Now that we have a parser, let't provide the two functions that a
;; language reader module needs to define. These are the read and
;; read-syntax functions.
-
(require "parser.rkt")
+
;; my-read: input-port -> s-expression
(define (my-read in)
(syntax->datum
View
0 lang/runtime.rkt → lang/semantics.rkt
File renamed without changes.

0 comments on commit d20c6b5

Please sign in to comment.
Something went wrong with that request. Please try again.