1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-19 01:28:26 +03:00
mal/racket/step0_repl.rkt

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)