String grammar
{{Short description|Structure of a computer language}}
The term "string grammar" in computational linguistics (and computer languages) refers to the structure of a specific language, such that it can be formatted as a single continuous string of text,{{cite book | chapter=A Bayesian model of syntax-directed tree to string grammar induction | first1=Trevor | last1=Cohn | title=Proceedings of the 2009 Conference on Empirical Methods in Natural Language Processing Volume 1 – EMNLP '09 | publisher=Association for Computational Linguistics | last2=Blunsom | first2=Phil | year=2009 | volume=1 | location=Morristown, NJ, USA | pages=352–361 | isbn=978-1-932432-59-6 | doi=10.3115/1699510.1699557| s2cid=2785745 }} without the need to have line-breaks (or newlines) to alter the meaning. The appearance of any text in "column 1" (or any column) of a line does not change the meaning of that text in a string grammar. A string grammar can be used to describe the structure of some natural languages, such as English or French,{{cite book | chapter=The elimination of grammatical restrictions in a string grammar of English | first1=M. | last1=Salkoff | title=Proceedings of the 1967 conference on Computational linguistics | last2=Sager | first2=N. | year=1967 | pages=1–15 | doi=10.3115/991566.991582| s2cid=12583235 }}{{cite book | first1=Morris | last1=Salkoff | url=https://books.google.com/books?id=XQVfczef-U8C&pg=PA12 | title=A French-English Grammar: A Contrastive Grammar on Translational Principles | series=Lingvisticæ Investigationes Supplementa | year=1999 | volume=22 | page=12 | isbn=978-90-272-3131-4 | doi=10.1075/lis.22}} as well as for some computer languages.
Note that the string-based structure is for defining the grammar of a language, rather than the formatting of the language itself. The production rules, of the grammar, are in the form of continuous text strings.
Benefits of using a string grammar
When a string grammar is used to define a computer language, some string-grammar parsing tools and compiler-generator tools can be used to more easily create a compiler software system for that particular computer language. Because other grammars can be more difficult to use for parsing text written in a specific computer language, using a string grammar is a means to seek simplicity in language processing.