Eurecom Dictionary
General overview
The project is not graded this year, and no report is required.
The objective of this project is to complete the C code of a dictionary management system. This system is built upon two components:- A file, storing words (in alphabetical order, or not),
- A C program called
words, performing operations on the dictionary. This program reads arguments from the command line, including commands to be performed on the dictionary (e.g., looking for a word), and returns an answer in the terminal. In your C code, you are asked to manipulate files using only system calls, e.g., withopen(),read(),write()andclose().
System specification
Overview
A dictionary is first stored on disk in a text file. Let's assume we have a dictionary file namedwords.txt. This text file contains a list of English words: one word per line. They don't have to be classified in alphabetical order.
A program, called words, that you ought to write, takes as input two references:
- A reference to a "command file" containing a list of commands, one command per line: these commands are to be executed by
words. Valid commands are given later. - A reference to a dictionary file (e.g., to words.txt)
words is:
$ ./words fileOfCommands words.txt
Actually, in the file repository (gitlab) we provide as input (see below), the dictionary file is in the subdirectory data, words is expected to be generated in bin by the Makefile, and we provide examples of command files in examples. Thus, in our file repository, a valid execution of
words looks like:
$ cd bin&&./words ../examples/commands1 ../data/words.txtDo add your own examples in order to debug your application as explained below.
Core commands
The core commands to implement are given in the following table. Additional commands are described in the Bonus section below. We assume that a dictionary named D has been provided as the second argument towords. Do use exactly the specified format for the outputs since we will check your outputs with our own tests. If you want to put extra information, do use a -debug options that activate extra outputs. A command must return either a number, OK, true, false, or error.
$ ./words -debug fileOfCommands words.txt
| Command | Action on D | Output (if no error) |
add word1 word2 word3 ... | adds words to D | OK |
remove word1 word2 ... | removes words from D | OK |
size | Total number of words in D (int) | |
save filename | saves D in "filename" in alphabetical order | OK |
search word | prints true if the word was found, false otherwise | |
help | help on commands |
For each command that could not be executed because of an error, "error" is output to the terminal. It may be optionnaly followed by a message, e.g., "error: memory allocation problem". Any other error or information message you may decide to use in your program must be sent to
stderr (and not to stdout). The maximum size for a command, including its parameters, is 10000 characters.
Implementation
Valid characters for words
All valid characters are the one present in words.txt. This includes:- Uppercase and lowercase letters
- Numbers 0-9
- ! & ' , - . /
$ man ascii
You can easily find this valid list of characters by running this bash command on the
words.txt file:
$ grep -o . data/words.txt | sort -uOr: another way to do:
$ cat data/words.txt | fold -w1 | sort | uniq
Compilation and execution
Your implementation must compile and run on the Linux PCs in the laboratory rooms. Even if the project compiles on your own computer, check that it also compiles on Eurecom PCs. Use the tests provided with the project to check the correctness of your program. You should also measure its execution time to understand and improve the performance of your implementation.We have prepared a C environment (Makefile, libraries, include) for the project in the following git: https://gitlab.eurecom.fr/ludovic.apvrille/basicos_project_fall2025_forstudents. Clone it as follows:
$ git clone https://gitlab.eurecom.fr/ludovic.apvrille/basicos_project_fall2025_forstudents.gitOnce cloned, have a look at the
README.md file at the root of this git repository.
Using the following command, we can compute how much time your program takes to execute commands given in the commands1.cmd file:
$ time make example1Run the provided tests on Eurecom PCs to check whether your program executes commands as expected and to measure its execution time. The
time command reports how much time your program used in user mode and in kernel mode. Each test reports whether your program is correct (PASSED / FAILED) and, if it passes, compares its execution time with the supplied reference time. For example, 90% means that your program takes 0.9 times the reference time, while 120% means that it takes 1.2 times the reference time. These tests are for practice and feedback; they do not contribute to a grade. We provide 10 tests, which you can run as follows.
$ make testTests covering bonus commands are relevant only when you implement those commands.
We also provide extra tests you may want to use. uncompress the file, and read the provided README file.
Bonus
The group of five students must implement two bonus commands in addition to the core commands. Choose two from advancedsize, advancedsearch1, advancedsearch2, advancedsearch3 and merge. Bonuses are optional for the groups of four students.
-
advancedsize. Count the words starting with the given prefix.Command Action on D Output (if no error) advancedsize abcounts words starting with "ab" in D Total number of matching words ( int) -
advancedsearch1. Search for words matching a pattern in which "?" matches any single character.Command Action on D Output (if no error) advancedsearch1 w?r?dsearches D for words matching the pattern trueif at least one word matches,falseotherwise -
advancedsearch2. Extend the advancedsearch1 command as follows. When no words were found, it still returnsfalse. But now, when it returnstrue, you should print in the same line all identified words, separated by a space. There must also be a space betweentrueand the first word. -
advancedsearch3command: this new command supports "?" and "*" when looking for words. "*" matches zero or more characters. For instance: "h*l?" should match "hello" and "hell" (and probably many others). - Implementing a command to merge a referenced dictionary file with the opened dictionary.
- Automatically compressing/uncompressing dictionary files.
| Command | Action on D | Output (if no error) |
advancedsearch2 w?r?d | true + list of words if is at least one word was found, false otherwise |
| Command | Action on D | Output (if no error) |
advancedsearch3 w*r?d | true i+ list of words if at least one word was found, false otherwise. |
| Command | Action on D | Output (if no error) |
merge refToFile | add all words of refToFile to D | ok |
Project organization
Program the specified system and keep your C source files, header files, Makefile and tests in your group's GitLab repository. The teaching team must be able to access and clone your repository on the first day of the project. Commit source files and tests, never files that can be generated by compilation.All members of the group must work on the general definition of the dictionary handling (loading in a data structure), and the implementation of the core functions (command analysis). Then, the implementation of commands must be split between the members of the group, as follows:
- Members #1 (leader): data structure management and size
- Members #2: remove and help
- Members #3: add and save
- Members #4: search
- In the group of five, member #5: implement the two required bonus commands and their tests, in coordination with the other members.
How to proceed?
Making groups
- Form 14 groups of 4 students and one group of 5 students (15 groups in total). Once your group has been established, I would like the designated group leader to send me an email providing the full names and email addresses of all the group members. In the subject line of your email, please include the phrase "[BasicOS] New group". Upon receiving your email, I will confirm your group's formation, assign you a group number.
- Set up a GitLab project on gitlab.eurecom.fr called exactly basicos2026-teamXX (replace XX with your two-digit group number; for group 1: basicos2026-team01). On the first day of the project, send me the link and grant repository access to me, Sophie Coudert and Yahya Frioui. Check that all three of us can access and clone the repository. We will use it to follow your progress during the project sessions.
Using AI wisely
Use AI to support your learning and your own reasoning. You must understand the code you write and be able to explain how it works.
- First project sessions: use AI only to help you get started, clarify concepts or ask for hints when you are stuck. For example, ask it to explain an error message or suggest a next step without giving the solution. Write the code yourselves; do not ask AI to generate or complete it.
- Last project session: you may use AI to help complete your coding. Review its suggestions, understand each change and check that the resulting program meets the specification.
- Throughout the project, including the last session: design, write and run your own tests. Choose the test inputs and determine the expected results yourselves. Do not use AI to generate your tests. Keeping your tests independent of AI-generated code helps you check the specification rather than repeat the same mistakes in both the implementation and its tests.
How to work?
- At the start of the project, understand the repository we provide (.c and .h files, and the Makefile). Clearly define the general structure of your project.
- Program the main framework together: handling of arguments, handling of main commands, handling of errors.
- Individually program the commands you are meant to implement. Make individual tests.
- Integrate all commands together and check that all your tests pass. Improve program performance. Add at least 5 more tests with more than 10 commands each (you can repeat a command to test it intensively).

