Incomputer programming,astringis traditionally asequenceofcharacters,either as aliteral constantor as some kind ofvariable.The latter may allow its elements to bemutatedand the length changed, or it may be fixed (after creation). A string is generally considered as adata typeand is often implemented as anarray data structureofbytes(orwords) that stores a sequence of elements, typically characters, using somecharacter encoding.Stringmay also denote more generalarraysor other sequence (orlist) data types and structures.
Depending on the programming language and precise data type used, avariabledeclared to be a string may either cause storage in memory to be statically allocated for a predetermined maximum length or employdynamic allocationto allow it to hold a variable number of elements.
When a string appears literally insource code,it is known as astring literalor an anonymous string.[1]
Informal languages,which are used inmathematical logicandtheoretical computer science,a string is a finite sequence ofsymbolsthat are chosen from asetcalled analphabet.
Purpose
editA primary purpose of strings is to store human-readable text, like words and sentences. Strings are used to communicate information from a computer program to the user of the program.[2]A program may also accept string input from its user. Further, strings may store data expressed as characters yet not intended for human reading.
Example strings and their purposes:
- A message like "
file upload complete
"is a string that software shows toend users.In the program'ssource code,this message would likely appear as astring literal. - User-entered text, like "
I got a new job today
"as a status update on asocial mediaservice. Instead of a string literal, the software would likely store this string in adatabase. - Alphabetical data, like "
AGATGCCGT
"representing nucleic acid sequences ofDNA.[3] - Computer settings or parameters, like "
?action=edit
"as a URLquery string.Often these are intended to be somewhat human-readable, though their primary purpose is to communicate to computers.
The term string may also designate a sequence of data or computer records other than characters — like a "string ofbits"— but when used without qualification it refers to strings of characters.[4]
History
editUse of the word "string" to mean any items arranged in a line, series or succession dates back centuries.[5][6]In 19th-Century typesetting,compositorsused the term "string" to denote a length of type printed on paper; the string would be measured to determine the compositor's pay.[7][4][8]
Use of the word "string" to mean "a sequence of symbols or linguistic elements in a definite order" emerged from mathematics,symbolic logic,andlinguistic theoryto speak about theformalbehavior of symbolic systems, setting aside the symbols' meaning.[4]
For example, logicianC. I. Lewiswrote in 1918:[9]
A mathematical system is any set of strings of recognisable marks in which some of the strings are taken initially and the remainder derived from these by operations performed according to rules which are independent of any meaning assigned to the marks. That a system should consist of 'marks' instead of sounds or odours is immaterial.
According toJean E. Sammet,"the first realistic string handling and pattern matching language" for computers wasCOMITin the 1950s, followed by theSNOBOLlanguage of the early 1960s.[10]
String datatypes
editAstring datatypeis a datatype modeled on the idea of a formal string. Strings are such an important and useful datatype that they are implemented in nearly everyprogramming language.In some languages they are available asprimitive typesand in others ascomposite types.Thesyntaxof most high-level programming languages allows for a string, usually quoted in some way, to represent an instance of a string datatype; such a meta-string is called aliteralorstring literal.
String length
editAlthough formal strings can have an arbitrary finite length, the length of strings in real languages is often constrained to an artificial maximum. In general, there are two types of string datatypes:fixed-length strings,which have a fixed maximum length to be determined atcompile timeand which use the same amount of memory whether this maximum is needed or not, andvariable-length strings,whose length is not arbitrarily fixed and which can use varying amounts of memory depending on the actual requirements at run time (seeMemory management). Most strings in modernprogramming languagesare variable-length strings. Of course, even variable-length strings are limited in length – by the size of availablecomputer memory.The string length can be stored as a separate integer (which may put another artificial limit on the length) or implicitly through a termination character, usually a character value with all bits zero such as in C programming language. See also "Null-terminated"below.
Character encoding
editString datatypes have historically allocated one byte per character, and, although the exact character set varied by region, character encodings were similar enough that programmers could often get away with ignoring this, since characters a program treated specially (such as period and space and comma) were in the same place in all the encodings a program would encounter. These character sets were typically based onASCIIorEBCDIC.If text in one encoding was displayed on a system using a different encoding, text was oftenmangled,though often somewhat readable and some computer users learned to read the mangled text.
Logographiclanguages such asChinese,Japanese,andKorean(known collectively asCJK) need far more than 256 characters (the limit of a one 8-bit byte per-character encoding) for reasonable representation. The normal solutions involved keeping single-byte representations for ASCII and using two-byte representations for CJKideographs.Use of these with existing code led to problems with matching and cutting of strings, the severity of which depended on how the character encoding was designed. Some encodings such as theEUCfamily guarantee that a byte value in the ASCII range will represent only that ASCII character, making the encoding safe for systems that use those characters as field separators. Other encodings such asISO-2022andShift-JISdo not make such guarantees, making matching on byte codes unsafe. These encodings also were not "self-synchronizing", so that locating character boundaries required backing up to the start of a string, and pasting two strings together could result in corruption of the second string.
Unicodehas simplified the picture somewhat. Most programming languages now have a datatype for Unicode strings. Unicode's preferred byte stream formatUTF-8is designed not to have the problems described above for older multibyte encodings. UTF-8, UTF-16 andUTF-32require the programmer to know that the fixed-size code units are different from the "characters", the main difficulty currently is incorrectly designed APIs that attempt to hide this difference (UTF-32 does makecode pointsfixed-sized, but these are not "characters" due to composing codes).
Implementations
edit
Some languages, such asC++,PerlandRuby,normally allow the contents of a string to be changed after it has been created; these are termedmutablestrings. In other languages, such asJava,JavaScript,Lua,Python,andGo,the value is fixed and a new string must be created if any alteration is to be made; these are termedimmutablestrings. Some of these languages with immutable strings also provide another type that is mutable, such as Java and.NET'sStringBuilder
,the thread-safe JavaStringBuffer
,and theCocoaNSMutableString
.There are both advantages and disadvantages to immutability: although immutable strings may require inefficiently creating many copies, they are simpler and completelythread-safe.
Strings are typically implemented asarraysof bytes, characters, or code units, in order to allow fast access to individual units or substrings—including characters when they have a fixed length. A few languages such asHaskellimplement them aslinked listsinstead.
A lot of high-level languages provide strings as a primitive data type, such asJavaScriptandPHP,while most others provide them as a composite data type, some with special language support in writing literals, for example,JavaandC#.
Some languages, such asC,PrologandErlang,avoid implementing a dedicated string datatype at all, instead adopting the convention of representing strings as lists of character codes. Even in programming languages having a dedicated string type, string can usually be iterated as a sequence character codes, like lists of integers or other values.
Representations
editRepresentations of strings depend heavily on the choice of character repertoire and the method of character encoding. Older string implementations were designed to work with repertoire and encoding defined by ASCII, or more recent extensions like theISO 8859series. Modern implementations often use the extensive repertoire defined by Unicode along with a variety of complex encodings such as UTF-8 and UTF-16.
The termbyte stringusually indicates a general-purpose string of bytes, rather than strings of only (readable) characters, strings of bits, or such. Byte strings often imply that bytes can take any value and any data can be stored as-is, meaning that there should be no value interpreted as a termination value.
Most string implementations are very similar to variable-lengtharrayswith the entries storing thecharacter codesof corresponding characters. The principal difference is that, with certain encodings, a single logical character may take up more than one entry in the array. This happens for example with UTF-8, where single codes (UCScode points) can take anywhere from one to four bytes, and single characters can take an arbitrary number of codes. In these cases, the logical length of the string (number of characters) differs from the physical length of the array (number of bytes in use).UTF-32avoids the first part of the problem.
Null-terminated
editThe length of a string can be stored implicitly by using a special terminating character; often this is thenull character(NUL), which has all bits zero, a convention used and perpetuated by the popularC programming language.[11]Hence, this representation is commonly referred to as aC string.This representation of ann-character string takesn+ 1 space (1 for the terminator), and is thus animplicit data structure.
In terminated strings, the terminating code is not an allowable character in any string. Strings withlengthfield do not have this limitation and can also store arbitrarybinary data.
An example of anull-terminated stringstored in a 10-bytebuffer,along with itsASCII(or more modernUTF-8) representation as 8-bithexadecimal numbersis:
F |
R |
A |
N |
K
|
NUL | k
|
e
|
f
|
w
|
4616 | 5216 | 4116 | 4E16 | 4B16 | 0016 | 6B16 | 6516 | 6616 | 7716 |
The length of the string in the above example, "FRANK
",is 5 characters, but it occupies 6 bytes. Characters after the terminator do not form part of the representation; they may be either part of other data or just garbage. (Strings of this form are sometimes calledASCIZ strings,after the originalassembly languagedirective used to declare them.)
Byte- and bit-terminated
editUsing a special byte other than null for terminating strings has historically appeared in both hardware and software, though sometimes with a value that was also a printing character.$
was used by many assembler systems,:
used byCDCsystems (this character had a value of zero), and theZX80used"
[12]since this was the string delimiter in its BASIC language.
Somewhat similar, "data processing" machines like theIBM 1401used a specialword markbit to delimit strings at the left, where the operation would start at the right. This bit had to be clear in all other parts of the string. This meant that, while the IBM 1401 had a seven-bit word, almost no-one ever thought to use this as a feature, and override the assignment of the seventh bit to (for example) handle ASCII codes.
Early microcomputer software relied upon the fact that ASCII codes do not use the high-order bit, and set it to indicate the end of a string. It must be reset to 0 prior to output.[13]
Length-prefixed
editThe length of a string can also be stored explicitly, for example by prefixing the string with the length as a byte value. This convention is used in manyPascaldialects; as a consequence, some people call such a string aPascal stringorP-string.Storing the string length as byte limits the maximum string length to 255. To avoid such limitations, improved implementations of P-strings use 16-, 32-, or 64-bitwordsto store the string length. When thelengthfield covers theaddress space,strings are limited only by theavailable memory.
If the length is bounded, then it can be encoded in constant space, typically a machine word, thus leading to animplicit data structure,takingn+kspace, wherekis the number of characters in a word (8 for 8-bit ASCII on a 64-bit machine, 1 for 32-bit UTF-32/UCS-4 on a 32-bit machine, etc.). If the length is not bounded, encoding a lengthntakes log(n) space (seefixed-length code), so length-prefixed strings are asuccinct data structure,encoding a string of lengthnin log(n) +nspace.
In the latter case, the length-prefix field itself does not have fixed length, therefore the actual string data needs to be moved when the string grows such that the length field needs to be increased.
Here is a Pascal string stored in a 10-byte buffer, along with its ASCII / UTF-8 representation:
length | F |
R |
A |
N |
K
|
k
|
e
|
f
|
w
|
0516 | 4616 | 5216 | 4116 | 4E16 | 4B16 | 6B16 | 6516 | 6616 | 7716 |
Strings as records
editMany languages, including object-oriented ones, implement strings asrecordswith an internal structure like:
classstring{
size_tlength;
char*text;
};
However, since the implementation is usuallyhidden,the string must be accessed and modified through member functions.text
is a pointer to a dynamically allocated memory area, which might be expanded as needed. See alsostring (C++).
Other representations
editBoth character termination and length codes limit strings: For example, C character arrays that contain null (NUL) characters cannot be handled directly byC stringlibrary functions: Strings using a length code are limited to the maximum value of the length code.
Both of these limitations can be overcome by clever programming.
It is possible to create data structures and functions that manipulate them that do not have the problems associated with character termination and can in principle overcome length code bounds. It is also possible to optimize the string represented using techniques fromrun length encoding(replacing repeated characters by the character value and a length) andHamming encoding[clarification needed].
While these representations are common, others are possible. Usingropesmakes certain string operations, such as insertions, deletions, and concatenations more efficient.
The core data structure in atext editoris the one that manages the string (sequence of characters) that represents the current state of the file being edited. While that state could be stored in a single long consecutive array of characters, a typical text editor instead uses an alternative representation as its sequence data structure—agap buffer,alinked listof lines, apiece table,or arope—which makes certain string operations, such as insertions, deletions, and undoing previous edits, more efficient.[14]
Security concerns
editThe differing memory layout and storage requirements of strings can affect the security of the program accessing the string data. String representations requiring a terminating character are commonly susceptible tobuffer overflowproblems if the terminating character is not present, caused by a coding error or anattackerdeliberately altering the data. String representations adopting a separate length field are also susceptible if the length can be manipulated. In such cases, program code accessing the string data requiresbounds checkingto ensure that it does not inadvertently access or change data outside of the string memory limits.
String data is frequently obtained from user input to a program. As such, it is the responsibility of the program to validate the string to ensure that it represents the expected format. Performinglimited or no validationof user input can cause a program to be vulnerable tocode injectionattacks.
Literal strings
editSometimes, strings need to be embedded inside a text file that is both human-readable and intended for consumption by a machine. This is needed in, for example, source code of programming languages, or in configuration files. In this case, the NUL character does not work well as a terminator since it is normally invisible (non-printable) and is difficult to input via a keyboard. Storing the string length would also be inconvenient as manual computation and tracking of the length is tedious and error-prone.
Two common representations are:
- Surrounded byquotation marks(ASCII0x22double quote
"str"
or ASCII 0x27 single quote'str'
), used by most programming languages. To be able to include special characters such as the quotation mark itself, newline characters, or non-printable characters,escape sequencesare often available, usually prefixed with thebackslashcharacter (ASCII 0x5C). - Terminated by anewlinesequence, for example in WindowsINI files.
Non-text strings
editWhile character strings are very common uses of strings, a string in computer science may refer generically to any sequence of homogeneously typed data. Abit stringorbyte string,for example, may be used to represent non-textualbinary dataretrieved from a communications medium. This data may or may not be represented by a string-specific datatype, depending on the needs of the application, the desire of the programmer, and the capabilities of the programming language being used. If the programming language's string implementation is not8-bit clean,data corruption may ensue.
C programmers draw a sharp distinction between a "string", aka a "string of characters", which by definition is always null terminated, vs. a "array of characters" which may be stored in the same array but is often not null terminated. UsingC string handlingfunctions on such an array of characters often seems to work, but later leads tosecurity problems.[15][16][17]
String processing algorithms
editThere are manyalgorithmsfor processing strings, each with various trade-offs. Competing algorithms can beanalyzedwith respect to run time, storage requirements, and so forth. The namestringologywas coined in 1984 by computer scientistZvi Galilfor the theory of algorithms and data structures used for string processing.[18][19][20]
Some categories of algorithms include:
- String searching algorithmsfor finding a given substring or pattern
- String manipulation algorithms
- Sorting algorithms
- Regular expressionalgorithms
- Parsinga string
- Sequence mining
Advanced string algorithms often employ complex mechanisms and data structures, among themsuffix treesandfinite-state machines.
Character string-oriented languages and utilities
editCharacter strings are such a useful datatype that several languages have been designed in order to make string processing applications easy to write. Examples include the following languages:
ManyUnixutilities perform simple string manipulations and can be used to easily program some powerful string processing algorithms. Files and finite streams may be viewed as strings.
SomeAPIslikeMultimedia Control Interface,embedded SQLorprintfuse strings to hold commands that will be interpreted.
Manyscripting programming languages,including Perl,Python,Ruby, and Tcl employregular expressionsto facilitate text operations. Perl is particularly noted for its regular expression use,[21]and many other languages and applications implementPerl compatible regular expressions.
Some languages such as Perl and Ruby supportstring interpolation,which permits arbitrary expressions to be evaluated and included in string literals.
Character string functions
editString functionsare used to create strings or change the contents of a mutable string. They also are used to query information about a string. The set of functions and their names varies depending on thecomputer programming language.
The most basic example of a string function is thestring lengthfunction – the function that returns the length of a string (not counting any terminator characters or any of the string's internal structural information) and does not modify the string. This function is often namedlength
orlen
.For example,length( "hello world" )
would return 11. Another common function isconcatenation,where a new string is created by appending two strings, often this is the + addition operator.
Somemicroprocessor'sinstruction set architecturescontain direct support for string operations, such as block copy (e.g. Inintel x86mREPNZ MOVSB
).[22]
Formal theory
editLet Σ be afinite setof distinct, unambiguous symbols (alternatively called characters), called thealphabet.Astring(orword[23]orexpression[24]) over Σ is any finitesequenceof symbols from Σ.[25]For example, if Σ = {0, 1}, then01011is a string over Σ.
Thelengthof a stringsis the number of symbols ins(the length of the sequence) and can be anynon-negative integer;it is often denoted as |s|. Theempty stringis the unique string over Σ of length 0, and is denotedεorλ.[25][26]
The set of all strings over Σ of lengthnis denoted Σn.For example, if Σ = {0, 1}, then Σ2= {00, 01, 10, 11}. We have Σ0= {ε} for every alphabet Σ.
The set of all strings over Σ of any length is theKleene closureof Σ and is denoted Σ*.In terms of Σn,
For example, if Σ = {0, 1}, then Σ*= {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011,...}. Although the set Σ*itself iscountably infinite,each element of Σ*is a string of finite length.
A set of strings over Σ (i.e. anysubsetof Σ*) is called aformal languageover Σ. For example, if Σ = {0, 1}, the set of strings with an even number of zeros, {ε, 1, 00, 11, 001, 010, 100, 111, 0000, 0011, 0101, 0110, 1001, 1010, 1100, 1111,...}, is a formal language over Σ.
Concatenation and substrings
editConcatenationis an importantbinary operationon Σ*.For any two stringssandtin Σ*,their concatenation is defined as the sequence of symbols insfollowed by the sequence of characters int,and is denotedst.For example, if Σ = {a, b,..., z},s=bear
,andt=hug
,thenst=bearhug
andts=hugbear
.
String concatenation is anassociative,but non-commutativeoperation. The empty string ε serves as theidentity element;for any strings,εs=sε =s.Therefore, the set Σ*and the concatenation operation form amonoid,thefree monoidgenerated by Σ. In addition, the length function defines amonoid homomorphismfrom Σ*to the non-negative integers (that is, a function,such that).
A stringsis said to be asubstringorfactoroftif there exist (possibly empty) stringsuandvsuch thatt=usv.Therelation"is a substring of" defines apartial orderon Σ*,theleast elementof which is the empty string.
Prefixes and suffixes
editA stringsis said to be aprefixoftif there exists a stringusuch thatt=su.Ifuis nonempty,sis said to be aproperprefix oft.Symmetrically, a stringsis said to be asuffixoftif there exists a stringusuch thatt=us.Ifuis nonempty,sis said to be apropersuffix oft.Suffixes and prefixes are substrings oft.Both the relations "is a prefix of" and "is a suffix of" areprefix orders.
Reversal
editThe reverse of a string is a string with the same symbols but in reverse order. For example, ifs= abc (where a, b, and c are symbols of the alphabet), then the reverse ofsis cba. A string that is the reverse of itself (e.g.,s= madam) is called apalindrome,which also includes the empty string and all strings of length 1.
Rotations
editA strings=uvis said to be a rotation oftift=vu.For example, if Σ = {0, 1} the string 0011001 is a rotation of 0100110, whereu= 00110 andv= 01. As another example, the string abc has three different rotations, viz. abc itself (withu=abc,v=ε), bca (withu=bc,v=a), and cab (withu=c,v=ab).
Lexicographical ordering
editIt is often useful to define anorderingon a set of strings. If the alphabet Σ has atotal order(cf.alphabetical order) one can define a total order on Σ*calledlexicographical order.The lexicographical order istotalif the alphabetical order is, but is notwell-foundedfor any nontrivial alphabet, even if the alphabetical order is. For example, if Σ = {0, 1} and 0 < 1, then the lexicographical order on Σ*includes the relationships ε < 0 < 00 < 000 <... < 0001 <... < 001 <... < 01 < 010 <... < 011 < 0110 <... < 01111 <... < 1 < 10 < 100 <... < 101 <... < 111 <... < 1111 <... < 11111... With respect to this ordering, e.g. the infinite set { 1, 01, 001, 0001, 00001, 000001,... } has no minimal element.
SeeShortlexfor an alternative string ordering that preserves well-foundedness. For the example alphabet, the shortlex order is ε < 0 < 1 < 00 < 01 < 10 < 11 < 000 < 001 < 010 < 011 < 100 < 101 < 0110 < 111 < 0000 < 0001 < 0010 < 0011 <... < 1111 < 00000 < 00001...
String operations
editA number of additional operations on strings commonly occur in the formal theory. These are given in the article onstring operations.
Topology
editStrings admit the following interpretation as nodes on a graph, wherekis the number of symbols in Σ:
- Fixed-length strings of lengthncan be viewed as the integer locations in ann-dimensionalhypercubewith sides of lengthk-1.
- Variable-length strings (of finite length) can be viewed as nodes on aperfectk-ary tree.
- Infinite strings(otherwise not considered here) can be viewed as infinite paths on ak-nodecomplete graph.
The natural topology on the set of fixed-length strings or variable-length strings is the discrete topology, but the natural topology on the set of infinite strings is thelimit topology,viewing the set of infinite strings as theinverse limitof the sets of finite strings. This is the construction used for thep-adic numbersand some constructions of theCantor set,and yields the same topology.
Isomorphismsbetween string representations of topologies can be found by normalizing according to thelexicographically minimal string rotation.
See also
edit- Binary-safe— a property of string manipulating functions treating their input as raw data stream
- Bit array— a string of binary digits
- C string handling— overview of C string handling
- C++ string handling— overview of C++ string handling
- Comparison of programming languages (string functions)
- Connection string— passed to a driver to initiate a connection (e.g., to a database)
- Empty string— its properties and representation in programming languages
- Incompressible string— a string that cannot be compressed by any algorithm
- Rope (data structure)— a data structure for efficiently manipulating long strings
- String metric— notions of similarity between strings
References
edit- ^"Introduction To Java – MFC 158 G".Archivedfrom the original on 2016-03-03.
String literals (or constants) are called 'anonymous strings'
- ^de St. Germain, H. James."Strings".University of Utah, Kahlert School of Computing.
- ^Francis, David M.; Merk, Heather L. (November 14, 2019)."DNA as a Biochemical Entity and Data String".
- ^abcBurchfield, R.W.(1986). "string".A Supplement to the Oxford English Dictionary.Oxford at the Clarendon Press.
- ^"string".The Oxford English Dictionary.Vol. X. Oxford at the Clarendon Press. 1933.
- ^"string (n.)".Online Etymology Dictionary.
- ^Whitney, William Dwight;Smith, Benjamin E."string".The Century Dictionary.New York: The Century Company. p. 5994.
- ^"Old Union's Demise".Milwaukee Sentinel.January 11, 1898. p. 3.
- ^Lewis, C.I.(1918).A survey of symbolic logic.Berkeley: University of California Press. p. 355.
- ^Sammet, Jean E. (July 1972)."Programming Languages: History and Future"(PDF).Communications of the ACM.15(7).doi:10.1145/361454.361485.S2CID2003242.
- ^ Bryant, Randal E.;David, O'Hallaron (2003),Computer Systems: A Programmer's Perspective(2003 ed.), Upper Saddle River, NJ: Pearson Education, p. 40,ISBN0-13-034074-X,archivedfrom the original on 2007-08-06
- ^Wearmouth, Geoff."An Assembly Listing of the ROM of the Sinclair ZX80".Archived from the original on August 15, 2015.
{{cite web}}
:CS1 maint: unfit URL (link) - ^Allison, Dennis."Design Notes for Tiny BASIC".Archivedfrom the original on 2017-04-10.
- ^ Charles Crowley. "Data Structures for Text Sequences"Archived2016-03-04 at theWayback Machine. Section "Introduction"Archived2016-04-04 at theWayback Machine.
- ^ "strlcpy and strlcat - consistent, safe, string copy and concatenation."Archived2016-03-13 at theWayback Machine
- ^ "A rant about strcpy, strncpy and strlcpy."Archived2016-02-29 at theWayback Machine
- ^ Keith Thompson. "No, strncpy() is not a" safer "strcpy()". 2012.
- ^"The Prague Stringology Club".stringology.org.Archivedfrom the original on 1 June 2015.Retrieved23 May2015.
- ^Evarts, Holly (18 March 2021)."Former Dean Zvi Galil Named a Top 10 Most Influential Computer Scientist in the Past Decade".Columbia Engineering.
He invented the terms 'stringology,' which is a subfield of string algorithms,
- ^Crochemore, Maxime (2002).Jewels of stringology.Singapore. p. v.ISBN981-02-4782-6.
The term stringology is a popular nickname for string algorithms as well as for text algorithms.
{{cite book}}
:CS1 maint: location missing publisher (link) - ^"Essential Perl".Archivedfrom the original on 2012-04-21.
Perl's most famous strength is in string manipulation with regular expressions.
- ^"x86 string instructions".Archivedfrom the original on 2015-03-27.
- ^Fletcher, Peter; Hoyle, Hughes; Patty, C. Wayne (1991).Foundations of Discrete Mathematics.PWS-Kent. p. 114.ISBN0-53492-373-9.
Let Σ be an alphabet. Anonempty word over Σis a finite sequence with domainIn(for somen∈ ℕ) and codomain Σ.
- ^Shoenfield, Joseph R.(2010) [1967].Mathematical Logic(Reprint ed.). CRC Press. p. 2.ISBN978-156881135-2.
Any finite sequence of symbols of a language is called anexpressionof that language.
- ^abBarbara H. Partee;Alice ter Meulen;Robert E. Wall (1990).Mathematical Methods in Linguistics.Kluwer.
- ^John E. Hopcroft, Jeffrey D. Ullman (1979).Introduction to Automata Theory, Languages, and Computation.Addison-Wesley.ISBN0-201-02988-X.Here: sect.1.1, p.1