A "high-level" language for the Gameboy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
502 B

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