/minidecaf

Web version of the MiniDecaf compiler.

Primary LanguageTypeScript

MiniDecaf Web

Web version of the MiniDecaf compiler. Implemented in TypeScript.

Getting Started

Install Dependencies

npm install

Run on Command Line

npm run grammar     # generate ANTLR4 grammar parser
npm run build
npm run cli <input_file> -- [options]
Options:
  -V, --version               output the version number
  -s, --asm                   generate the RISC-V assembly code instead of executing
  -r, --ir                    generate the intermediate representation (IR)
  -t, --timeout <second>      set execution timeout (in seconds)
  -o, --output <output_file>  save the output to file
  -c, --trunc                 truncate the return code to 8-bit integer
  -d, --debug                 debug mode
  -h, --help                  display help for command

Build Website & Run in Browsers

Build JavaScript files for browsers:

npm run build-web

Start a simple HTTP server:

npm run serve

Visit http://127.0.0.1:8080 to preview.

Test

Test one file:

npm run test    # or `npm run test-codegen`

Test all test cases in test/minidecaf-tests:

npm run test-all -- [options]
Options:
  -n <step>                   run all testcases starts from step1 to this step. default is `12`.
  -s                          generate the assembly code (RISC-V) and run in the simulator instead
                              of running as an interpreter.