From 55c00566b0c4870d4c4409ab3e93aacf74f8d081 Mon Sep 17 00:00:00 2001 From: Lizzy Hunt Date: Wed, 28 Feb 2024 15:06:00 -0700 Subject: identity function, repl upgrade --- src/index.ts | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index 29047f2..d162465 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,7 @@ import { type LogLevel, type TracingLogger, } from '@/utils'; -import { evaluate } from '@/interpreter'; +import { doRepl } from './repl'; const LOG_LEVELS: LogLevel[] = ['info', 'warn', 'error']; @@ -30,18 +30,6 @@ const devMode = async (logger: TracingLogger) => { } }; -const doRepl = async (prompt = '~> ') => { - process.stdout.write(prompt); - - for await (const line of console) { - const result = await evaluate(line); - console.log(result); - break; - } - - await doRepl(prompt); -}; - export const main = async (args: Args) => { if (args.devMode) { LOG_LEVELS.push('debug'); @@ -55,9 +43,9 @@ export const main = async (args: Args) => { } if (args.repl) { - logger.info('Starting REPL...'); - logger.info('Welcome to the CPS interpreter!'); + await doRepl(logger); } + return 0; }; -main(args); +main(args).then(code => process.exit(code)); -- cgit v1.2.3-70-g09d2