Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
add "executed in" message
Browse files Browse the repository at this point in the history
  • Loading branch information
iwl-lyam committed Jan 25, 2022
1 parent 9707888 commit c1d4648
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2,678 deletions.
3 changes: 3 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#!/usr/bin/env node

import stopwatch from 'statman-stopwatch'
import {Interpret} from '../interpreter.js'
import {Lexer} from '../lexer.js'
import {Parse} from '../parser.js'
import * as fs from 'fs'

export default function runner() {
const timer = new stopwatch(true)
let program = process.argv[2]

if (!program) process.exit(1)

let tokens = Lexer(fs.readFileSync(program).toString())
let script = Parse(tokens)
Interpret(script, false)
console.log("Executed in " + Math.floor(timer.stop()) + " ms")
}
runner()

0 comments on commit c1d4648

Please sign in to comment.