# grammar (10-grammar.com) Grammar is the set of rules for how words fit together in a language so that sentences make sense. People talk about grammar when they mean correct or polished writing and speech. ## What a model may hear - formal grammar (computer science and linguistics): expects a strict mathematical description of which strings are valid, such as context-free or regular grammars - parser grammar (programming language design and compilers): looks for a formal specification file that defines syntax rules for parsing code - grammar checking (natural language processing tools): assumes the user wants automated detection of errors in text, not discussion of rules - grammar of graphics (data visualization, especially ggplot): expects layered plotting specifications mapping data to visual elements ## Where people and models part ways - Says: "Fix the grammar in this sentence." Means: Make my writing sound more correct or natural. May be taken as: Applies rigid formal rules and overcorrects colloquial or stylistic choices that were intentional. Say instead: "Make this sentence sound more natural and polished, keeping my tone." - Says: "What is the grammar of this language?" Means: Explain how this human language works. May be taken as: Generates a formal BNF or context-free grammar notation that is unreadable to the user. Say instead: "Explain the basic rules of how sentences work in this language, in plain terms." - Says: "Use good grammar." Means: Write clearly and professionally. May be taken as: Interprets as a command to follow prescriptive school rules and produces stilted prose. Say instead: "Write in a clear, professional style that sounds natural to a general reader." - Says: "Show me the grammar." Means: Teach me the rules. May be taken as: Outputs code in a grammar specification format like EBNF or YAML. Say instead: "Teach me the rules with examples, not code or symbols." ## Tips - Say 'rules of writing' instead of 'grammar' if you want style advice, not syntax theory. - Add 'for a human reader' when you want natural language, not formal notation. - Specify 'programming language grammar' if you actually need parser rules. - Say 'grammar of graphics' explicitly if you mean data visualization layers. - Ask for 'examples, not symbols' to block formal notation output. ## Often confused with - syntax: more technical, often means code structure not prose style - style: broader than grammar, covers tone and word choice too - semantics: meaning of language, not the rules for forming it - parsing: the process of analyzing structure, not the rules themselves - orthography: spelling and writing conventions, not sentence structure - usage: how people actually write, not formal rule systems