cccat is a custom implementation of the Unix cat command, written in Standard ML (SML). This implementation does not address all the cat command options.
This project was created as a solution to the "Build Your Own cat Tool" coding challenge. After doing the Programming Languages, Part A course and solving multiple problems using the Standard ML programming language, I thought that it would be good if I did a project using the Standard ML programming language. So I did that challenge.
- Read and output the contents of a single file.
- Concatenate and display the contents of multiple files.
- Read from standard input (stdin) when no files are provided or when
-is used. - (Optional) Line numbering flags (depending on implementation status):
-n: Number all output lines.-b: Number nonempty output lines.
To build and run this project, you will need:
- Moscow ML: An implementation of Standard ML used to compile the source code.
- Go: Required to run the end-to-end test suite.
-
Clone the repository:
git clone [https://github.com/ahmedsameha1/cccat.git](https://github.com/ahmedsameha1/cccat.git) cd cccat -
Compile the source code: Use the Moscow ML compiler (
mosmlc) to build the executable.mosmlc -o cccat cccat.sml
This command creates an executable named
cccat(orcccat.exeon Windows).
After compiling, you can use the tool just like the standard cat command.
./cccat hello.txt./cccat hello.txt quotes.txt./cccat
./cccat -
echo "Hello World" | ./cccat
This project uses Go for end-to-end integration testing.
go test ./...
.
├── endtoendtests/ # Directory containing Go end-to-end tests
├── cccat.sml # Main application source code (Standard ML)
├── go.mod # Go module definition for test dependencies
├── go.sum # Go checksums for dependencies
├── *.txt # Sample text files used for testing.
└── README.md