McIlroy is considered to be a pioneer of macro processors. In 1959, together with Douglas E. Eastwood of Bell Labs, he introduced conditional and recursive macros into popular SAP assembler, creating what is known as Macro SAP. His 1960 paper was also seminal in the area of extending any programming languages through macro processors. These contributions started the macro-language tradition at Bell Labs. McIlroy's macro processing ideas were also the main inspiration for TRACmacro processor. He also coauthored M6 macro processor in FORTRAN IV, which was used in ALTRAN and later was ported to and included into early versions of Unix.
Contributions to Unix
Throughout the 1960s and 1970s McIlroy contributed programs for Multics and Unix operating systems, versions of which are widespread to this day through adoption of the POSIX standard and Unix-like operating systems. He introduced the idea of Unix pipelines. He also implemented TMG compiler-compiler in PDP-7 and PDP-11 assembly, which became the first high-level programming language running on Unix, prompting development and influencing Ken Thompson's B programming language and Stephen Johnson's Yacc parser-generator. McIlroy also took over from Dennis Ritchie compilation of the Unix manual "as a labor of love". According to Sandy Fraser: "The fact that there was a manual, that he insisted on a high standard for the manual, meant that he insisted on a high standard for every one of the programs that was documented".
Computer language design
McIlroy influenced the design and implementation of SNOBOL programming language. His string manipulation macros were used extensively in the initial SNOBOL implementation of 1962, and figured prominently in subsequent work, eventually leading to its machine-independent implementation language SIL. The table type was added to SNOBOL4 on McIlroy's insistence in 1969. In 1960s, he participated in the design of PL/I programming language. He was a member of the IBM–SHARE committee that designed the language and, together with Robert Morris, wrote the Early PL/I compiler in TMG for the Multics project. Around 1965, McIlroy, together with W. Stanley Brown, implemented the original version of ALTRAN programming language for IBM 7094 computers. McIlroy has also made a significant influence on design of the programming language C++.
Algorithms
In the 1990s, McIlroy worked on improving sorting techniques, particularly he co-authored an optimized Quicksort algorithm with Jon Bentley. In 1969, he contributed an efficient algorithm to generate all spanning trees in a graph.
McIlroy is attributed the quote "The real hero of programming is the one who writes negative code," where the meaning of negative code is taken to be similar to the famous Apple developer team anecdote.