Skip to content

equation314/minidecaf

 
 

Repository files navigation

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.

Packages

No packages published

Languages

  • TypeScript 76.4%
  • JavaScript 15.3%
  • HTML 3.2%
  • ANTLR 2.7%
  • Shell 2.1%
  • C 0.3%