Explore tens of thousands of sets crafted by our community.
Lexical Analysis Tokens
26
Flashcards
0/26
Arithmetic operator token
Arithmetic operators perform mathematical calculations. Examples include '+', '-', '*', '/', and '%'.
Punctuator token
Punctuators serve as delimiters in program constructs. They include symbols like ';', ',', '.', '{}' (braces), '[]' (brackets), and '()' (parentheses).
Block comment token
Block comments are used to comment out blocks of code or add multi-line explanations. In C/C++, they are enclosed by '/*' and '*/'.
Type qualifier token
Type qualifiers specify additional information about the variables' types. Examples in C/C++ include 'const', 'volatile'.
Integer constant token
Integer constants represent numeric values. Rules include consisting only of digits (0-9), no leading zeros unless the number is zero itself, possibly preceded by a sign (+ or -).
Array subscript token
Array subscripts specify an element in an array using an index enclosed in brackets. For example, `array[3]` refers to the fourth element of 'array'.
Relational operator token
Relational operators compare two values. Examples include '>', '<', '>=', '<=', '==', '!='.
Macro token
Macros are fragments of code which are given a name. In C/C++, they are defined with '#define' and replaced by their definition throughout the code.
Line comment token
Line comments are used to add explanatory remarks to the code. Different languages use different symbols like '//' in C/C++ or '#' in Python for the whole line.
Assignment operator token
Assignment operators are used to assign values to variables. The basic assignment operator is '=', but there are compound operators like '+=', '-=', '*=', and '/='.
Bitwise operator token
Bitwise operators operate on binary representations of integers. They include '&', '|', '^' (XOR), '~' (NOT), '<<' (left shift), and '>>' (right shift).
Function call token
Function call tokens are used to invoke a function and are followed by parentheses containing the argument list, e.g., `printf('Hello World');`.
Keyword token
Keywords are reserved words pre-defined by the programming language which have special meanings. Examples include 'if', 'while', 'return'. They cannot be used as identifiers.
Structure member token
Structure member tokens are used to access a member of a structure or union. In C/C++, the dot operator '.' is used for direct access, while '->' is used for pointers.
Storage class specifier token
Storage class specifiers define the scope, visibility, and lifecycle of variables and/or functions. Examples in C/C++ include 'static', 'extern', 'auto', 'register'.
Preprocessor directive token
Preprocessor directives are instructions processed before compilation. Examples in C/C++ include '#include', '#define', '#if', '#else', '#endif'.
Logical operator token
Logical operators are used to evaluate boolean expressions. Examples include '&&' (logical AND), '||' (logical OR), and '!' (logical NOT).
Escape sequence token
Escape sequences are special sequences of characters used to represent certain special characters within string and character literals, like '\n' for newline, '\t' for tab.
Floating-point constant token
Floating-point constants represent numbers with fractional parts. They have digits on both sides of the decimal point, may include an exponent part, and can have a sign.
Boolean constant token
Boolean constants represent the truth values. In most languages, they are `true` and `false`.
Identifier token
An identifier is a lexical token that names language entities. Some of the rules might include: must begin with a letter or underscore, can be followed by letters, digits, or underscores, sensitive to case.
Character constant token
Character constants represent a single character enclosed within quotes. Rules include being surrounded by single quotes, representing a single character, or an escape sequence.
String literal token
String literals are a sequence of characters surrounded by double quotes. They can include escape sequences and represent text.
Enumeration constant token
Enumeration constants are user-defined types in C/C++ that consist of named integer constants. An example is `enum { RED, GREEN, BLUE };`.
Null pointer token
The null pointer is a special pointer value that means the pointer points to nothing. In C/C++, 'NULL', or in newer C++ standards, 'nullptr' represents the null pointer.
Whitespace token
Whitespace characters are used to separate tokens in the source code and include spaces, tabs, newlines, and comments, although they are often ignored except as separators.
© Hypatia.Tech. 2024 All rights reserved.