~deciduously/nlox

ref: 0f2f20d1105e10e8ffd66bb0d8c2efedd34198dc nlox/src/nlox.nim -rw-r--r-- 494 bytes
0f2f20d1Ben Lovy Scanner 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This is just an example to get you started. A typical hybrid package
# uses this file as the main entry point of the application.

import nloxpkg/lox
import os

let usage*: string = "Usage: nlox [script]"

when isMainModule:
    let params = commandLineParams()
    let num_params = params.len()
    let interpreter = new_lox()

    if num_params > 1:
        echo usage
        quit(64)
    elif num_params == 1:
      interpreter.run_file(params[0])
    else:
      interpreter.run_prompt()