ChocoPy Compiler By Bill Sun
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.
 
 
 
 
 
 
sunyinqi0508 9bf0c359ee
Merge branch 'master' into bill/worklog_debugging_finished
4 years ago
pa1-tests disclose hiden tests 4 years ago
src Merge branch 'master' into bill/worklog_debugging_finished 4 years ago
.gitignore Initial commit 4 years ago
LICENSE Initial commit 4 years ago
README.md Initial commit 4 years ago
WORKLOG.md Merge branch 'master' into bill/worklog_debugging_finished 4 years ago
build.sh Added test scripts to ease testing 4 years ago
chocopy-ref.jar Initial commit 4 years ago
full_test.sh Added test scripts 4 years ago
pom.xml Initial commit 4 years ago
test_gen.sh Final bug fixes. 4 years ago
test_py_file.sh Added student test cases 4 years ago
test_sample.sh Added test scripts 4 years ago
test_student_contributed.sh Added test scripts 4 years ago

README.md

NYU Compiler Construction CSCI-GA.2130/Spring 2021: Programming Assignment 2

This assignment is adapted from https://github.com/cs164berkeley/pa2-chocopy-semantic-analysis with the authors' permission.

See the PA2 document on Piazza for a detailed specification.

Quickstart

Run the following commands to compile your analyzer and run the tests:

mvn clean package
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy \
  --pass=.s --test --dir src/test/data/pa2/sample/

The dot in --pass makes the compiler skip parsing and go straight to semantic analysis. --pass=.s uses your (s for student) analyzer to perform semantic analysis on a preparsed input (in this case, the .ast files under src/test/data/pa2/sample/). With the starter code, only two tests should pass. Your main objective is to build an analyzer that passes all the provided tests.

--pass=.r uses the reference (r for reference) analyzer, which should pass all tests.

In addition to running in test mode with --test, you can also observe the actual output of your (or reference) analyzer with:

java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy \
  --pass=.s src/test/data/pa2/sample/expr_unary.py.ast

You can also run both passes on the original .py file:

java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy \
  --pass=rr src/test/data/pa2/sample/expr_unary.py

Once you merge your parser code from assignment 1, you should be able to use --pass=ss.