mirror of
https://github.com/kanaka/mal.git
synced 2024-09-20 01:57:09 +03:00
28 lines
397 B
Racket
Executable File
28 lines
397 B
Racket
Executable File
#!/usr/bin/env racket
|
|
#lang racket
|
|
|
|
(require "readline.rkt" "types.rkt")
|
|
|
|
;; read
|
|
(define (READ str)
|
|
str)
|
|
|
|
;; eval
|
|
(define (EVAL ast env)
|
|
ast)
|
|
|
|
;; print
|
|
(define (PRINT exp)
|
|
exp)
|
|
|
|
;; repl
|
|
(define (rep str)
|
|
(PRINT (EVAL (READ str) "")))
|
|
|
|
(define (repl-loop)
|
|
(let ([line (readline "user> ")])
|
|
(when (not (eq? nil line))
|
|
(printf "~a~n" (rep line))
|
|
(repl-loop))))
|
|
(repl-loop)
|