|
|
|
|
|
by pacaro
3286 days ago
|
|
One of my takeaways from TFA was along the lines of… "Hmmm… he's using strtok, that's not how a real shell would work. What would a minimal shell, without scripting, pipes, redirects etc. do? Just correctly parsing legal file paths (which TFA needs to correctly implement 'cd') is well out of scope of a small article like this." |
|
You have backslashes, single quotes, and double quotes basically. Traditionally this is done with switch statement in a loop in C.
But that is not a good approach for a real shell. Even inside double quotes you can have a fully recursive program, like:
Once you have recursion then you need some kind of parser, not just a lexer.