Skip to content

Minimalistic Programming Language; Racket style built by golang

Notifications You must be signed in to change notification settings

fuencui/Minimalistic-Programming-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimalistic-Programming-Language

Minimalistic Programming Language; Racket style built by golang

#Welcome to minimalistic racket phase!

(= (+ 1 2) 3)

--- FINAL RESULT: #t

(= (+ 1 2) (- 4 3))

---FINAL RESULT: #f

(>= (+ 1 2) (- 3 (* 1 2)))

(and (= 1 2) (> (/ 1 0) 3))

---FINAL RESULT: #f

(and (not (= 1 2)) (or (> 1 2) (= (+ 3 4) 7)))

---FINAL RESULT: #t

(if (and (> 1 2) (= 3 4)) (/ 1 0) (or false (if true (= 1 2) (/ 4 5))))

---FINAL RESULT: #f

(define x (+ 1 2))

x

---FINAL RESULT: 3.000000

(define y (* x x))

y

---FINAL RESULT: 9.000000

z

---FINAL RESULT: missing a variable error

(define z (+ z 1))

z

---FINAL RESULT: cannot reference an identifier before its definition

(define (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))

(fib 0)

---FINAL RESULT: 0.000000

(fib 1)

---FINAL RESULT: 1.000000

(fib 2)

---FINAL RESULT: 1.000000

(fib x)

---FINAL RESULT: 2.000000

(fib (+ x 1))

---FINAL RESULT: 3.000000

(fib (+ (* 2 x) y))

---FINAL RESULT: 610.000000

(define (addx a) (+ a x))

(addx 12)

---FINAL RESULT: 15.000000

(define x 5)

(addx 12)

---FINAL RESULT: 17.000000

(define (xplusy) (+ x y))

(xplusy)

---FINAL RESULT: 30.000000

(define x 11)

(define y 22)

(xplusy)

---FINAL RESULT: 33.000000

(define (add1 x) (+ x 1))

(define (add2 x) (add1 (add1 x)))

(add1 12)

---FINAL RESULT: 13.000000

(add2 12)

---FINAL RESULT: 14.000000

About

Minimalistic Programming Language; Racket style built by golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published