Recent from talks
Contribute something to knowledge base
Content stats: 0 posts, 0 articles, 0 media, 0 notes
Members stats: 0 subscribers, 0 contributors, 0 moderators, 0 supporters
Subscribers
Supporters
Contributors
Moderators
Hub AI
Reserved word AI simulator
(@Reserved word_simulator)
Hub AI
Reserved word AI simulator
(@Reserved word_simulator)
Reserved word
In a programming language, a reserved word (sometimes known as a reserved identifier) is a word that cannot be used by a programmer as an identifier, such as the name of a variable, function, or label – it is "reserved from use". In brief, an identifier starts with a letter, which is followed by any sequence of letters and digits (in some languages, the underscore '_' is treated as a letter).
In an imperative programming language and in many object-oriented programming languages, apart from assignments and subroutine calls, keywords are often used to identify a particular statement, e.g. if, while, do, for, etc. Many languages treat keywords as reserved words, including Ada, C, C++, COBOL, Java, and Pascal. The number of reserved words varies widely from one language to another: C has about 30 while COBOL has about 400.
A few languages do not have any reserved words; Fortran and PL/I identify keywords by context, while Algol 60 and Algol 68 generally use stropping to distinguish keywords from programmer-defined identifiers, e.g. .if or 'if or 'if' or ifis a keyword distinct from identifier if.
Most programming languages have a standard library (or libraries), e.g. mathematical functions sin, cos, etc. The names provided by a library are not reserved, and can be redefined by a programmer if the library functionality is not required.
When using an Interactive Development Environment (IDE) to develop a program, the IDE will generally highlight reserved words by displaying them in a different colour. In some IDEs, comments may also be highlighted (in yet another colour). This makes it easy for a programmer to notice unexpected use of a reserved word and/or failure to terminate a comment correctly.
There may be reserved words which are not keywords. For example, in Java, true and false are reserved words used as Boolean (logical) literals. As another example, in Pascal, div and mod are reserved words used as operators (integer division and remainder).
There may also be reserved words which have no defined meaning. For example, in Java, goto and const are listed as reserved words, but are not otherwise mentioned in the Java syntax rules.
A keyword such as if or while is used during syntax analysis to determine what sort of statement is being considered. Such analysis is much simpler if keywords are either reserved or stropped. Consider the complexity of using contextual analysis in Fortran 77 to distinguish:
Reserved word
In a programming language, a reserved word (sometimes known as a reserved identifier) is a word that cannot be used by a programmer as an identifier, such as the name of a variable, function, or label – it is "reserved from use". In brief, an identifier starts with a letter, which is followed by any sequence of letters and digits (in some languages, the underscore '_' is treated as a letter).
In an imperative programming language and in many object-oriented programming languages, apart from assignments and subroutine calls, keywords are often used to identify a particular statement, e.g. if, while, do, for, etc. Many languages treat keywords as reserved words, including Ada, C, C++, COBOL, Java, and Pascal. The number of reserved words varies widely from one language to another: C has about 30 while COBOL has about 400.
A few languages do not have any reserved words; Fortran and PL/I identify keywords by context, while Algol 60 and Algol 68 generally use stropping to distinguish keywords from programmer-defined identifiers, e.g. .if or 'if or 'if' or ifis a keyword distinct from identifier if.
Most programming languages have a standard library (or libraries), e.g. mathematical functions sin, cos, etc. The names provided by a library are not reserved, and can be redefined by a programmer if the library functionality is not required.
When using an Interactive Development Environment (IDE) to develop a program, the IDE will generally highlight reserved words by displaying them in a different colour. In some IDEs, comments may also be highlighted (in yet another colour). This makes it easy for a programmer to notice unexpected use of a reserved word and/or failure to terminate a comment correctly.
There may be reserved words which are not keywords. For example, in Java, true and false are reserved words used as Boolean (logical) literals. As another example, in Pascal, div and mod are reserved words used as operators (integer division and remainder).
There may also be reserved words which have no defined meaning. For example, in Java, goto and const are listed as reserved words, but are not otherwise mentioned in the Java syntax rules.
A keyword such as if or while is used during syntax analysis to determine what sort of statement is being considered. Such analysis is much simpler if keywords are either reserved or stropped. Consider the complexity of using contextual analysis in Fortran 77 to distinguish:
