On the other hand, I don't believe Dave Cutler would have ever allowed /usr/src to ship with the source code to the kernel.
On the other hand, I don't believe Dave Cutler would have ever allowed /usr/src to ship with the source code to the kernel.
I can't believe that anyone with taste would want CMD.EXE, and the criticism is deep.
(1) COMMAND.COM cut a lot of corners, in significant part due to being written in assembly and designed to run on machines with very low memory (DOS 1.0 would run on machines with only 32KB of RAM)
(2) Backward compatibility meant a lot of the questionable decisions in (1) had to be maintained
(3) At some point Microsoft stopped investing in it, and didn't do anything further to add new features or file off more rough edges
I think (1) and (2) were kind of inevitable, but (3) is a decision Microsoft has made much more recently
I wish they'd open-source CMD.EXE and start accepting PRs for it – I think some of the worst things about it (e.g. the "Terminate batch job (Y/N)?" prompt which is impossible to turn off without patching the executable) would get fixed. But I doubt they'll do that because they just want people to focus on PowerShell instead–and before PowerShell, it was the same thing for VBScript
Though with PowerShell being cross-platform and already open source, I personally don't think there's enough to gain in some sort of better open source CMD.EXE fork. I'd be interested in being proved wrong on that, but I'm also happy enough with PowerShell these days I'm not in a hurry to return to CMD.EXE.
[0] https://github.com/microsoft/terminal/tree/main/src/host
I think there are plenty of little annoyances in CMD.EXE which could be fixed. That prompt I mentioned is the most obvious one, but I'm sure there are more.
DOS batch compatibility could easily be met with a secondary command shell.
NT's primary command shell could have reworked AWK's grammar into an interactive shell.
It's a shame that the NT command shell did not recieve the attention that it deserved. DCL would have been preferable (if you like FORTRAN).
There are plenty of parser generators other than yacc, many of which accept different types of grammars from LR (e.g. LL parsers, PEG parsers). I'm not sure why it should matter whether a command processor's grammar is LR or LL or whatever.
I don't know as much about the descent of the COMMAND.COM of MS-DOS with the influence of OS/2 into NT CMD.EXE, but I can say with certainty that it was no better.
We needed something clean and maintainable, and we didn't get it.
https://archive.fosdem.org/2018/schedule/event/code_parsing_...
But not being LR-parsed in particular seems like a red herring – if it had been designed to be cleanly LL-parsed, I don't think anyone would be complaining.
...and that's the point. A shell language with no inconsistencies or ambiguities is what we needed, and we didn't get it.
A language with a formal yacc grammar would have helped us get it. Neither the POSIX shell nor CMD.EXE are ever going to meet such a requirement.
I don't know if DCL was clean enough to have a yacc grammar. If it was, then it would have been a better choice.
I don't know why you are defending such a precept when the weaknesses are so very well known.
EDIT: A yacc grammar might be preferred as yacc itself is part of POSIX.2, assuring many implementations.
You can find lex and yacc here:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/
However, had any formal grammar been used, it would have been far better than what we have now.
I agree that a command processor should have a grammar that can be expressed in a well-known formalism, and its parser generated by a parser generator.
I agree that both POSIX shell and CMD.EXE are flawed because that isn't true.
What I'm disagreeing with, is that it is important that the grammar formalism be LALR(1) in particular, and that the parser generator be yacc in particular.
Suppose I have a Packrat parser generator. [0] And my command processor has a nice clean PEG grammar. [1] And I use the Packrat parser generator to generate the parser of my command processor. That grammar quite possibly isn't LALR(1), and hence yacc in particular won't be able to generate a parser for it. But what's the problem with that? If it is a problem at all, it is a very different problem than the problem that CMD.EXE and POSIX shell have
[0] e.g. https://github.com/arithy/packcc
[1] https://en.wikipedia.org/wiki/Parsing_expression_grammar
Because the OS is a sequel and replacement to DOS, and so it has a DOS-like shell.
Speaking as a former professional VMS, DOS, Windows and NT sysadmin:
I preferred CMD to any Unix shell, and I still do. I had boxes to run. I am not a programmer and I don't want programmers' tools.
It is much more use to me to be able to do:
move *.00? oldlogs
And have it pick all files matching the wildcard and move them to the folder -- without needing to be told it's a folder -- than it is for me to be able to write shell scripts.
mv *.00? oldlogs
Just sayin'. =) ren *.htm *.html