aboutsummaryrefslogtreecommitdiff
path: root/src/tmachines.nim
blob: e67f5e3bea5805a0b0f1355b87af4e0f38038552 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os

import docopt

import tmachinespkg/tm

const tmname {.strdefine.}: string = ""

when tmname.len > 0:
  const tmd = parse(slurp(tmname & ".tm"))
  if paramCount() >= 1:
    echo makeDTM(tmd, paramStr(1)).test(false)
  else:
    echo "please specify a single string argument"
else:
  const doc = slurp("../USAGE.txt")

  let args = docopt(doc)

  let tmd = parse(readFile($args["<machine>"] & ".tm"))
  echo makeDTM(tmd, $args["<input>"]).test(not args["--quiet"])