Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I assure you I didn't get my reward checks without doing it.
A notable achievement I'm sure, but let's use facts rather than achievements to back up arguments.
You certainly can implement a queue with a linked list (but that is not the only possible implementation - you could implement a queue using an array if you chose to). That doesn't mean that a linked list is equivalent to a queue. Those who use, for example, FIFO queues in their programs would probably not impressed by your pettifogging. If it pleases you then by all means please yourself.
sortie wrote:The best way of making a shell is writing a lexer and a parser that generates an abstract syntax tree representing the commands that user want executed. This is trivial for a shell that only understands 'foo bar baz' commands, but things get more complicated if you add environmental variables, escape characters, quotes, pipes, conditionals, and all the other good shell features. Depending on your shell language, another approach may be better, but lexer+parser is a good and well-understood solution for parsing context-free programming languages.
Why use a stack as a stack? Just allocate 256 characters as a string and fill it up from the start using user-input. When it fills up completely, you reallocate and double its size and then continue. When you encounter a newline, you discard that character, put in a '\0' that terminates the string and call execute_a_shell_command(const char*). Voila!
My operating system is written entirely in assembly so the best approach would be doing something like this ?
iansjack wrote:You certainly can implement a queue with a linked list (but that is not the only possible implementation - you could implement a queue using an array if you chose to). That doesn't mean that a linked list is equivalent to a queue. Those who use, for example, FIFO queues in their programs would probably not impressed by your pettifogging. If it pleases you then by all means please yourself.
You missed the point. I never claimed linked lists were the only possible implementation (I even used the word "usually" to suggest the contrary). A data structure is a pattern of data organization---it is already an implementation. ADT's are defined by their semantics.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]