Can computers effectively correct grammatical errors? This paper introduces a novel approach to error recognition and correction in context-free languages, utilizing a syntax-directed least-errors analyzer. The research builds upon Earley's well-known recognizer, incorporating elements of Bellman's dynamic programming. The analyzer takes a general class of **context-free grammars** as drivers and any finite string as input. The core of the process is computing a least-errors count for a corrected version of the input relative to the driver grammar. The design of the algorithm places a strong emphasis on practical aspects to facilitate easier implementation and programming. The resulting system is a robust **least-errors recognizer** capable of handling a wide range of inputs and providing a quantitative measure of syntactic correctness. This approach has potential applications in areas such as natural language processing, compiler design, and intelligent tutoring systems. Further research could focus on optimizing the algorithm for improved performance and expanding its capabilities to handle more complex grammatical structures.
Published in Communications of the ACM, this paper aligns with the journal's focus on computer science, particularly in the areas of computer software and programming languages. The development of a least-errors recognizer for context-free languages directly contributes to the field of compiler design and parsing, a core topic covered by Communications of the ACM.