From f14dfd0fd36d3a3dbf9c6996ac39fe324901c062 Mon Sep 17 00:00:00 2001 From: Paul Hilfinger <Hilfinger@cs.berkeley.edu> Date: Fri, 12 Apr 2019 12:38:35 -0700 Subject: [PATCH] Update README and add checkpoint_tests.txt. --- README.md | 24 ++++++++++++++---------- checkpoint_tests.txt | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 checkpoint_tests.txt diff --git a/README.md b/README.md index 1535d9f..eb0f40f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Run the following command to build your compiler, and then run all the provided ``` mvn clean package -java -cp "chocopy-ref.jar:lib/venus164.jar:target/assignment.jar" chocopy.ChocoPy --pa3 chocopy.pa3.StudentCodeGen --run --dir src/test/data/pa3/sample/ --test +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=..s --run --dir src/test/data/pa3/sample/ --test ``` In the starter code, only one test should pass. Your objective is to implement a code generator that passes all the provided tests and meets the assignment specifications. @@ -18,17 +18,16 @@ You can also run the code generator on one input file at at time. In general, ru 1. First, run the reference parser to get an AST JSON: ``` -java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pa1 chocopy.reference.RefParser --in <chocopy_input_file> --out <ast_json_file> +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=r <chocopy_input_file> --out <ast_json_file> ``` - 2. Second, run the reference analysis on the AST JSON to get a typed AST JSON: ``` -java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pa2 chocopy.reference.RefAnalysis --in <ast_json_file> --out <typed_ast_json_file> +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=.r <ast_json_file> --out <typed_ast_json_file> ``` 3. Third, run your code generator on the typed AST JSON to get a RISC-V assembly file: ``` -java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pa3 chocopy.pa3.StudentCodeGen --in <typed_ast_json_file> --out <assembly_file> +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=..s <typed_ast_json_file> --out <assembly_file> ``` The `src/tests/data/pa3/sample` directory already contains the typed AST JSONs for the test programs (with extension `.out.typed`); therefore, you can skip the first two steps for the sample test programs. @@ -38,22 +37,23 @@ The `src/tests/data/pa3/sample` directory already contains the typed AST JSONs f To run a generated RISC-V program in the Venus-164 execution environment, run: ``` -java -cp "chocopy-ref.jar:lib/venus164.jar:target/assignment.jar" chocopy.ChocoPy --run --in <assembly_file> +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --run <assembly_file> ``` ### Chained commands -For quick development, you can chain all the stages `--pa1`, `--pa2`, `--pa3`, and `--run` to directly execute a ChocoPy program: +For quick development, you can chain all the stages +to directly execute a ChocoPy program: ``` -java -cp "chocopy-ref.jar:lib/venus164.jar:target/assignment.jar" chocopy.ChocoPy --pa1 chocopy.reference.RefParser --pa2 chocopy.reference.RefAnalysis --pa3 chocopy.pa3.StudentCodeGen --run --in <chocopy_input_file> +java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=rrs --run <chocopy_input_file> ``` You can omit the `--run` in the above chain to print the generated assembly program instead of executing it. ### Running the reference implementation -To observe the output of the reference implementation of the code generator, replace the class `chocopy.pa3.StudentCodeGen` with `chocopy.reference.RefCodeGen` in any command where applicable. +To observe the output of the reference implementation of the code generator, replace `--pass=rrs` with `--pass=rrr` in any command where applicable. ## Assignment specifications @@ -68,7 +68,7 @@ Refer to `chocopy_implementation_guide.pdf` for information on the design of the Add the `upstream` repository remotes (you only need to do this once in your local clone): ``` -git remote add upstream https://github.com/cs164fall2018/pa3-chocopy-code-generation.git +git remote add upstream https://github.com/cs164spring2019/pa3-chocopy-code-generation.git ``` To sync with updates upstream: @@ -82,4 +82,8 @@ Team member 1: Team member 2: +Team member 3: + +Team member 4: + (Students should edit this section with their write-up) diff --git a/checkpoint_tests.txt b/checkpoint_tests.txt new file mode 100644 index 0000000..6dc3823 --- /dev/null +++ b/checkpoint_tests.txt @@ -0,0 +1,23 @@ +src/test/data/pa3/sample/literal_bool.py +src/test/data/pa3/sample/literal_int.py +src/test/data/pa3/sample/literal_str.py +src/test/data/pa3/sample/id_global.py +src/test/data/pa3/sample/id_local.py +src/test/data/pa3/sample/var_assign.py +src/test/data/pa3/sample/call.py +src/test/data/pa3/sample/call_with_args.py +src/test/data/pa3/sample/nested.py +src/test/data/pa3/sample/nested2.py +src/test/data/pa3/sample/op_add.py +src/test/data/pa3/sample/op_cmp_bool.py +src/test/data/pa3/sample/op_cmp_int.py +src/test/data/pa3/sample/op_div_mod.py +src/test/data/pa3/sample/op_logical.py +src/test/data/pa3/sample/op_mul.py +src/test/data/pa3/sample/op_negate.py +src/test/data/pa3/sample/op_sub.py +src/test/data/pa3/sample/stmt_if.py +src/test/data/pa3/sample/stmt_while.py +src/test/data/pa3/sample/stmt_return_early.py +src/test/data/pa3/benchmarks/exp.py +src/test/data/pa3/benchmarks/prime.py -- GitLab