summaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts20
1 files changed, 4 insertions, 16 deletions
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));