summaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorLizzy Hunt <lizzy.hunt@usu.edu>2024-02-28 15:06:00 -0700
committerLizzy Hunt <lizzy.hunt@usu.edu>2024-02-28 15:06:00 -0700
commit55c00566b0c4870d4c4409ab3e93aacf74f8d081 (patch)
tree4226b7e518a3ab88987d544ea892da42952255ee /src/index.ts
parentd39cf84965dffd11cab440f5a4efa1b16932ba73 (diff)
downloadcps-interpreter-55c00566b0c4870d4c4409ab3e93aacf74f8d081.tar.gz
cps-interpreter-55c00566b0c4870d4c4409ab3e93aacf74f8d081.zip
identity function, repl upgrade
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));