Skip to content
Snippets Groups Projects
Commit f14dfd0f authored by Paul Hilfinger's avatar Paul Hilfinger
Browse files

Update README and add checkpoint_tests.txt.

parent 2b84ae0d
No related branches found
No related tags found
No related merge requests found
Pipeline #87 failed with stages
in 1 minute and 8 seconds
...@@ -7,7 +7,7 @@ Run the following command to build your compiler, and then run all the provided ...@@ -7,7 +7,7 @@ Run the following command to build your compiler, and then run all the provided
``` ```
mvn clean package 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. 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 ...@@ -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: 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: 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: 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. 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 ...@@ -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: 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 ### 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. You can omit the `--run` in the above chain to print the generated assembly program instead of executing it.
### Running the reference implementation ### 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 ## Assignment specifications
...@@ -68,7 +68,7 @@ Refer to `chocopy_implementation_guide.pdf` for information on the design of the ...@@ -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): 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: To sync with updates upstream:
...@@ -82,4 +82,8 @@ Team member 1: ...@@ -82,4 +82,8 @@ Team member 1:
Team member 2: Team member 2:
Team member 3:
Team member 4:
(Students should edit this section with their write-up) (Students should edit this section with their write-up)
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment