From 86b689f3d7111a9fa13da389a30f3dfdf877d1a4 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Sat, 19 Apr 2014 13:04:09 -0500 Subject: All: *ARGV* and *host-language*. Misc syncing/fixes. --- bash/step1_read_print.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'bash/step1_read_print.sh') diff --git a/bash/step1_read_print.sh b/bash/step1_read_print.sh index ca852ed..e7ca283 100755 --- a/bash/step1_read_print.sh +++ b/bash/step1_read_print.sh @@ -1,17 +1,15 @@ #!/bin/bash -INTERACTIVE=${INTERACTIVE-yes} - source $(dirname $0)/reader.sh source $(dirname $0)/printer.sh -# READ: read and parse input +# read READ () { [ "${1}" ] && r="${1}" || READLINE READ_STR "${r}" } -# EVAL: just return the input +# eval EVAL () { local ast="${1}" local env="${2}" @@ -20,7 +18,7 @@ EVAL () { r="${ast}" } -# PRINT: +# print PRINT () { if [[ "${__ERROR}" ]]; then _pr_str "${__ERROR}" yes @@ -31,16 +29,15 @@ PRINT () { fi } -# REPL: read, eval, print, loop +# repl REP () { READ "${1}" || return 1 EVAL "${r}" PRINT "${r}" } -if [[ -n "${INTERACTIVE}" ]]; then - while true; do - READLINE "user> " || exit "$?" - [[ "${r}" ]] && REP "${r}" && echo "${r}" - done -fi +# repl loop +while true; do + READLINE "user> " || exit "$?" + [[ "${r}" ]] && REP "${r}" && echo "${r}" +done -- cgit v1.2.3