Assignment 4: Executables, File I/O, S-expressions
In this assignment, you will write an executable to count the number of occurances of each OCaml keyword in a given directory.
File structure and requirements
- Use this zip file as the starting point for your assignment.
- You are given instructions in
src/lib/histogram.mlito write aHistogrammodule that you will use to count keywords.- Implement this module in
src/lib/histogram.ml. - The starter code is incomplete as given. You will need to read the
mlifile and fill in some well-typed value in themlfile for each declaration to get the project to build. - You may add to the
mliif needed, but you may not change or delete anything that exists there as given. - The histogram works on keywords. A
Keywordmodule is implemented for you insrc/lib/keyword.ml.
- Implement this module in
- You’ll write an executable in
bin/keywordcount.ml. There are full instructions in that file, and there are lots of tips for this assignment. Some starter code is provided to help with command-line argument parsing.- Before beginning anything on this assignment, you should read
src/bin/keywordcount.ml.
- Before beginning anything on this assignment, you should read
- If you need any helper functions that might be tested, then they go in
src/lib/utils.ml(i). - You are given some initial (incomplete) tests in
src-test/hist_tests.mlandsrc-test/exec_tests.ml.- You must add at least 10 non-redundant
assert_equalstatements tosrc-test/tests.mlto test your code in theHistogramand/orUtilsmodules. - You are not graded on the total testing coverage of any part of your code, but moving helper functions to
src/lib/utils.ml(i)gives you more ways to hit those 10 non-redundantassert_equalstatements.
- You must add at least 10 non-redundant
- We have given you
dunefiles which generally should work, but you can add libraries if needed.
Submission and Grading
- Follow the same protocol for Gradescope submission as previous assignments.
- do a final
dune clean; dune buildfrom the main directory and submit the_build/default/assignment4.zipfile.
- do a final
- The submitted files include only the files you are supposed to edit, along with your
dunefiles and any additional testing resources in thetest/directory. You do not submit the providedmltest files, but you will submit themlifiles. - We will grade the style of your code. Please consult the FPSE Style Guide.
- You will also be graded on your added tests.