Read-eval-print loop. An example is the prompt created when you type the command python3.
What shall I do?
I would say, the following; although you may do it differently:
In the file src/cli/cli-handler.h, add a function prototype to handle prompt. This function shall be marked with SMOL_API. It should return an int, since that is our way to handle errors. It should also take a pointer to an InputBuf (because we're modifying it).
In the src/cli/cli-handler.c file, implement the function. In cli-handler.c file, you can add some helper functions (declare them near the start of the file, marked with SMOL_INTERNAL).
This function shall:
First, prompt the user for input (refer to how python3 does it when you type the command.
Second, read user input and update the InputBuf passed in accordingly.
The third action, handling inputs, can be implemented after we finish another issue: create a Trie to handle tokens.
So, after successfully implementing the first 2 steps, we have a prompt (that unfortunately has to be force quitted). We will implement some basic commands in the next issue.
What is a REPL?
python3
.What shall I do?
SMOL_API
. It should return anint
, since that is our way to handle errors. It should also take a pointer to anInputBuf
(because we're modifying it).SMOL_INTERNAL
).python3
does it when you type the command.InputBuf
passed in accordingly.