- import { promises } from "fs"
- import { basename, resolve } from "path"
-
- import { compile } from "./compile"
-
- const { readFile } = promises
-
- // TODO: Proper command-line argument support
- if (process.argv.length !== 3) {
- console.error("usage: gbuoy <program.gby>")
- process.exit(1)
- }
-
- const fileName = process.argv[2]
- const localName = basename(resolve(fileName))
-
- readFile(fileName, { encoding: "utf-8" }).then(source => {
- const output = compile(localName, source)
- console.log(output)
- })
|