
Java
In a
Java program, all characters are grouped into symbols called
tokens. Larger language features are built from the first five categories of tokens (the sixth kind of token is recognized, but is then discarded by the
Java compiler from further processing). We must learn how to identify all six kind of tokens that can appear in
Java programs. In EBNF we write one simple rule that captures this structure:
token <=
identifier|
keyWord |
separator |
operator |
literal |
comment The different types of Tokens are:
# Identifiers: names the programmer chooses # KeyWords: names already in the programming language # Separators (also known as punctuators): punctuation characters and paired-delimiters # Operators: symbols that operate on arguments and produce results # Literals (specified by their type) #* Numeric: intand double #* Logical: boolean #* Textual: char and String #* Reference: null # Comments #* Line