Skip to content
Snippets Groups Projects
Commit ef1c8b1d authored by Sang-Hoon Kim's avatar Sang-Hoon Kim
Browse files

Revise specifications

parent f4993810
No related branches found
No related tags found
No related merge requests found
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
### Goal ### Goal
Implement a simple string parser to get familiar with PASubmit system. Implement a simple string parser to get familiar with (PASS)[https://sslab.ajou.ac.kr/pass] system.
### Problem Specification ### Problem Specification
We will implement a MIPS interpreter soon. To that end, you should first make a simple program that understands user inputs and commands. We will implement a MIPS interpreter soon (no worries, you will get to know what it means soon). To that end, you should first make a simple program that understands user inputs and commands.
In this project, your task is to **split an input strings into command tokens**. By the C standard, a string is defined as a sequence of characters which is terminated with `\0`. Command tokens are the strings that are obtained by splitting the input string with delimitors which are whitespace characters in this PA. Any heading and trailing whitespaces should be also removed from the command tokens. Multiple whitespaces in a row can be considered as a single whitespace. In this project, your task is to **split an input strings into command tokens**. By the C standard, a string is defined as a sequence of characters which is terminated with `\0`. Command tokens are the strings that are obtained by splitting the input string with delimitors, which are whitespace characters in this PA. Any heading and trailing whitespaces should be also removed from the command tokens. Multiple whitespaces in a row can be considered as a single whitespace.
For example, if the input string is " Hello world ", the command tokes are "Hello" and "world". **Note that the input string is split into tokens delimited by whitespaces (' ' in this example), and the tokens do not contain any whitespaces**. For example, let's think about an input string " Hello world ". The command tokes are "Hello" and "world". **Note that the input string is split into tokens delimited by whitespaces (' ' in this example), and the tokens do not contain any whitespaces**.
Another example string is " add r1 r2 r3 ". It should be tokenized into "add", "r1", "r2", and "r3". Another example string is " add r1 r2 r3 ". It should be tokenized into "add", "r1", "r2", and "r3".
...@@ -33,15 +33,16 @@ tokens[4]... = NULL ...@@ -33,15 +33,16 @@ tokens[4]... = NULL
### Restrictions ### Restrictions
- You **should not use any string manipulation functions from any libraries**. Followings are the banned functions; - You **should not use any string manipulation functions from any libraries**. Followings are the banned functions;
- All C library functions starting with 'str' (e.g., `strtok`, `strlen`, `strcpy`, ...) - All C library functions starting with `str` (e.g., `strtok`, `strlen`, `strcpy`, ...)
- All C library functions starting with 'mem' (e.g., `memcpy`, `memmove`, ...) - All C library functions starting with `mem` (e.g., `memcpy`, `memmove`, ...)
- All C library functions ending with 'scanf' (e.g., `scanf`, `fscanf`, ...) - All C library functions ending with `scanf` (e.g., `scanf`, `fscanf`, ...)
- bcopy - `bcopy`
This implies that you should implement your own string manipulation functions if you need it. **You will get 0 point if you use any of them**. Note that `malloc()` and `free()` are not string manipulation functions so you can use it if needed. If unsure, question to the instructor through AjouBb. This implies that you should implement your own string manipulation functions if you need it. **You will get 0 point if you use any of them**. Note that `malloc()` and `free()` are not string manipulation functions so you can use it if needed. If unsure, question to the instructor through AjouBb.
- Do not change or redefine `parse_command()` and `main()` functions; use the functions and their arguments as-is. - Do not change or redefine `parse_command()` and `main()` functions; use the functions and their arguments as-is.
- Use `isspace()` C library function to check whether a character can be assumed as a whitespace. - Use `isspace()` C library function to check whether a character can be assumed as a whitespace.
- Printing messages to stand output (e.g., `printf()`) is okay. However, do not `fprintf(stderr ...)` otherwise the grading system cannot grade your submission properly. - Printing messages to stand output (e.g., `printf()`) is OK, but do not `fprintf(stderr ...)` since the grading system evaluates your work with the output to the `stderr`.
- For all PAs in this class (including this and next ones), you can freely change the code as you want as long as **it does not violate the stated restriction**. For example, you can include as many header files as you want since it is not explicitly prohibited. Also, you can define your own custom functions in addition to the provided ones.
- For all PAs (including this and next ones), the restriction is applied like a blacklist (c.f., whitelist); you can do whatever you want to do as long as it is not explicitly restricted**. For example, you can include as many header files as you want since it is not explicitly prohibited. Also, you can define your own custom functions in addition to the provided ones.
### Logistics ### Logistics
...@@ -49,11 +50,11 @@ This implies that you should implement your own string manipulation functions if ...@@ -49,11 +50,11 @@ This implies that you should implement your own string manipulation functions if
- This is an individual project; you work on the assignement alone. - This is an individual project; you work on the assignement alone.
- You can use **up to 3 slip tokens throughout this semester**. - You can use **up to 3 slip tokens throughout this semester**.
- The instructor will not answer to questions during the grace period. - The instructor will not answer to questions during the grace period.
- All submission and grading are done automatically through (PASS)[https://sslab.ajou.ac.kr/pass]. Please follow the instruction explained in the class. - All submission and grading are done automatically through (PASS)[https://sslab.ajou.ac.kr/pass]. Please follow the instructions explained in the class.
- Submit `pa0.c` file. Make sure that you turn in the right file with the designated file name. (90 pts) - Submit `pa0.c` file. Make sure that you turn in the right file with the designated file name. (90 pts)
- Explain your parsing strategy on a **1-page PDF document**. (10 pts) - Explain your parsing strategy on a **1-page PDF document**. (10 pts)
- No need to turn in the git repository; ignore that in this PA. - No need to turn in the git repository; ignore git in this PA.
- `input-simple` and `input-adv` files in the provided code contain the input sequences for the grading. They contain whitespaces in special characters which are usually not properly handled when you copy-paste the contents. Thus, specify the file name as the input instead of copy-pasting it for testing (read `main()` how you can pass it as the input). - `input-simple` and `input-adv` files in the code template contain the input sequences for the grading. They contain whitespaces in special characters which are usually not properly handled when you copy-paste the contents. Thus, specify the file name as the input instead of copy-pasting it for testing (read `main()` how you can pass it as the input).
### Tips and Notes ### Tips and Notes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment