Title: Theory / Unimportant / CS / Programming / Java / Grammar
Tags: FromInstruction computer_to_instruction comment hasNotNewEffectReturnsMeaning hasSeenConjDef

Definition: Define a nonterminal foo with possible values bar_i
Page: 10
Chapter: 2
Section: 4
Context: context-free gramar
Notation: foo:
bar_1
_ ...
_ bar_n
Notation2: (one of)
bar_1 ... bar_n

Definition: any number of repetition of foo
Page: 10
Chapter: 2
Section: 4
Context: context-free gramar
Notation: {foo}

Definition: Optionnaly foo
Page: 10
Chapter: 2
Section: 4
Context: context-free gramar
Notation: [foo]

Definition: The grammar foo, excluding what is accepted by bar
Page: 10
Chapter: 2
Section: 4
Context: context-free gramar
Notation: foo but not bar

Question: The encoding of java code is
Answer: unicode, using UTF-16
Page: 15
Chapter: 3
Section: 1
Context: context-free gramar

Question: The encoding of java program is
Answer: ascii, except from comment, string, character and identifiers
Page: 16
Chapter: 3
Section: 1
Context: context-free gramar

Question: Lexical translation
Answer: \uxxxx becomes unicode character
Page: 16
Chapter: 3
Section: 2
Context: context-free gramar
Answer2: translation of the Unicode stream resulting from step 1 into a stream of input characters and line terminators.
Answer3: Discarding whitespaces and creating a list of token

Question: In case of ambiguity during tokenization
Answer: the longest token is chosen, except for list of > in a type context, where is interpreted as >
Page: 17
Chapter: 3
Section: 2

Question: How do java transform unicode into ascii for ascii tools
Answer: \uxxxx becomes \uuxxxx, other unicode character are replaced by \uxxxx for xxxx their encoding
Page: 18
Chapter: 3

Name: newline
Page: 19
Chapter: 3
Section: 4
Context: ascii character
Notation: LF

Name: return
Page: 19
Chapter: 3
Section: 4
Context: ascii character
Notation: CR

Name: LineTerminator
Definition: LF, CR, or CRLF
Page: 19
Chapter: 3
Section: 4
Context: grammar

Name: InputCharacter
Definition: UnicodeInputCharacter but not CR or LF
Page: 19
Chapter: 3
Section: 4
Context: grammar

Name: RawInputCharacter
Definition: any Unicode character
Page: 19
Chapter: 3
Section: 4
Context: grammar

Name: HexDigit
Definition: (one of)
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
Page: 19, 28
Chapter: 3
Section: 4, 10
Context: grammar

Name: UnicodeMarker
Definition: u { u }
Page: 17
Chapter: 3
Section: 4
Context: grammar

Name: UnicodeEscape
Definition: \ UnicodeMarker HexDigit HexDigit HexDigit HexDigit
Page: 17
Chapter: 3
Section: 4
Context: grammar

Name: UnicodeInputCharacter
Definition: UnicodeEscape
RawInputCharacter
Page: 17
Chapter: 3
Section: 4
Context: Grammar Ascii

Name: ASCII SUB
Definition: control-Z
Page: 20
Chapter: 3
Section: 5
Context: Grammar Ascii

Name: Token
Definition: Identifier
Page: 20
Chapter: 3
Section: 6
Context: Grammar java
Definition2: Keyword
Conjdef: Either
Definition3: Literal
Definition4: Separator
Definition5: Operator

Name: InputElement
Definition: WhiteSpace
Page: 20
Chapter: 3
Section: 6
Context: Grammar Ascii
Definition2: Comment
Conjdef: Either
Definition3: Token

Name: Input
Definition: {InputElement} [Sub]
Page: 20
Chapter: 3
Section: 6
Context: Grammar Ascii

Name: x is to the right of y
Definition: x occurs after y in the list of tokens
Page: 20
Chapter: 3
Section: 6
Variables: x,y tokens
Context: Grammar Ascii
Name2: y is to the left of x

Name: White space
Definition: ASCII space character, horizontal tab character, form feed character, and line terminator characters
Page: 20
Chapter: 3
Section: 6
Context: Grammar Ascii

Instruction: //foo
Page: 21
Effect: none
Language: java
Context: Grammar Ascii
Chapter: 3
Section: 7
Name: EndOfLineComment:

Name: NotStarNotSlash
Definition: InputCharacter but not * or /
LineTerminator
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii

Name: NotStar
Definition: InputCharacter but not *
LineTerminator
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii

Name: CommentTailStar
Definition: /
*CommentTailStar
NotStarNotSlash CommentTail
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii

Name: CommentTail
Definition: * CommentTailStar
NotStar CommentTail
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii

Name: TraditionalComment:
Definition: / * CommentTail
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii

Name: Comment
Definition: EndOfLineComment
Page: 21
Chapter: 3
Section: 7
Context: Grammar Ascii
Definition2: TraditionalComment
Conjdef: Either

Name: JavaLetterOrDigit:
Definition: any Unicode character that is a "Java letter-or-digit"
Page: 21
Chapter: 3
Section: 8
Context: Grammar Ascii

Name: JavaLetter
Definition: any Unicode character that is a "Java letter"
Page: 22
Chapter: 3
Section: 8
Context: Grammar Ascii

Name: IdentifierChars
Definition: JavaLetter {JavaLetterOrDigit}
Page: 22
Chapter: 3
Section: 8
Context: Grammar Ascii

Name: Identifier
Definition: IdentifierChars but not a Keyword or BooleanLiteral or NullLiteral
Page: 22
Chapter: 3
Section: 8
Context: Grammar

Instruction: Character.isJavaIdentifirStart(foo)
Page: 23
Language: java
Context: Grammar
Chapter: 3
Section: 8
Returns: whether foo belongs to JavaLetter

Instruction: Character.isJavaIdentifierPart(foo)
Page: 23
Language: java
Context: Grammar
Chapter: 3
Section: 8
Returns: whether foo belongs to JavaLetterOrDigit:

Instruction: Character.isIdentifierIgnorable(foo)
Page: 23
Language: java
Context: Grammar
Chapter: 3
Section: 8
Returns: whether foo is an ignorable character

Name: TypeIdentifier
Definition: identifier but not var
Page: 24
Chapter: 3
Section: 8
Context: Java Grammar

Name: keyword
Definition: (one of)
abstract
continue
assert
default
boolean
do
break
double
byte
else
case
enum
catch
extends
char
final
class
finally
const
float
_ (underscore)
for
if
goto
implements
import
instanceof
int
interface
long
native
new
package
private
protected
public
return
short
static
strictfp
super
switch
synchronized
this
throw
throws
transient
try
void
volatile
while
Page: 24
Chapter: 3
Section: 9
Context: java
Counterexample: true, false, null, var

Name: restricted keyword
Definition: open , module , requires , transitive , exports , opens , to , uses , provides , and with .
Page: 24
Chapter: 3
Section: 9
Context: Grammar
Intuition: tokenized as keywords solely where they appear as terminals in the ModuleDeclaration, ModuleDirective, and RequiresModifier productions (§7.7).

Name: Literal
Definition: IntegerLiteral
Page: 25
Chapter: 3
Section: 10
Context: java Grammar
Definition2: FloatingPointLiteral
Conjdef: Either
Definition3: BooleanLiteral
Intuition: source code representation of a value of a primitive type
Definition4: CharacterLiteral
Definition5: StringLiteral
Definition6: NullLiteral

Name: IntegerLiteral
Definition: DecimalIntegerLiteral
Page: 25
Chapter: 3
Section: 10.1
Context: Grammar
Definition2: HexIntegerLiteral
Conjdef: Either
Definition3: OctalIntegerLiteral
Definition4: BinaryIntegerLiteral

Name: DecimalIntegerLiteral
Definition: DecimalNumeral [IntegerTypeSuffix]
Page: 25
Chapter: 3
Section: 10.1

Name: HexIntegerLiteral
Definition: HexNumeral [IntegerTypeSuffix]
Page: 25
Chapter: 3
Section: 10.1

Name: OctalIntegerLiteral
Definition: OctalNumeral [IntegerTypeSuffix]
Page: 26
Chapter: 3
Section: 10.1

Name: BinaryIntegerLiteral
Definition: BinaryNumeral [IntegerTypeSuffix]
Page: 26
Chapter: 3
Section: 10.1

Name: IntegerTypeSuffix
Definition: (one of)
l L
Page: 26
Chapter: 3
Section: 10.1

Question: the type of an integer literal is
Answer: long if suffixed by l or L, otherwise int
Page: 26
Chapter: 3
Section: 10.1

Name: NonZeroDigit
Definition: (one of) 1 2 3 4 5 6 7 8 9
Page: 27
Chapter: 3
Section: 10.1

Name: Underscores
Definition: _ { _ }
Page: 27
Chapter: 3
Section: 10.1

Name: DigitOrUnderscore
Definition: Digit
_
Page: 27
Chapter: 3
Section: 10.1

Name: DigitsAndUnderscores
Definition: DigitOrUnderscore {DigitOrUnderscore}
Page: 27
Chapter: 3
Section: 10.1

Name: Digit
Definition: 0
NonZeroDigit
Page: 27
Chapter: 3
Section: 10.1

Name: Digits
Definition: Digit
Digit [DigitsAndUnderscores] Digit
Page: 27
Chapter: 3
Section: 10.1

Name: DecimalNumeral
Definition: 0
NonZeroDigit [Digits]
NonZeroDigit Underscores Digits
Page: 27
Chapter: 3
Section: 10.1

Name: OctalNumeral
Definition: 0 OctalDigits
0 Underscores OctalDigits
Page: 29
Chapter: 3
Section: 10.1

Name: HexNumeral
Definition: 0 x HexDigits
0 X HexDigits
Page: 28
Chapter: 3
Section: 10.1

Name: BinaryNumeral
Definition: 0b BinaryDigits
0B BinaryDigits
Page: 30
Chapter: 3
Section: 10.1

Name: OctalDigits
Definition: OctalDigit
OctalDigit [OctalDigitsAndUnderscores] OctalDigit
Page: 29
Chapter: 3
Section: 10.1

Name: HexDigits
Definition: HexDigit
HexDigit [HexDigitsAndUnderscores] HexDigit
Page: 28
Chapter: 3
Section: 10.1

Name: BinaryDigits
Definition: BinaryDigit
BinaryDigit [BinaryDigitsAndUnderscores] BinaryDigit
Page: 30
Chapter: 3
Section: 10.1

Name: OctalDigitsAndUnderscores
Definition: OctalDigitOrUnderscore {OctalDigitOrUnderscore}
Page: 29
Chapter: 3
Section: 10.1

Name: HexDigitsAndUnderscores
Definition: HexDigitOrUnderscore {HexDigitOrUnderscore}
Page: 28
Chapter: 3
Section: 10.1

Name: BinaryDigitsAndUnderscores
Definition: BinaryDigitOrUnderscore {BinaryDigitOrUnderscore}
Page: 30
Chapter: 3
Section: 10.1

Name: OctalDigitAndUnderscore
Definition: OctalDigit
_
Page: 29
Chapter: 3
Section: 10.1

Name: HexDigitAndUnderscore
Definition: HexDigit
_
Page: 28
Chapter: 3
Section: 10.1

Name: BinaryDigitAndUnderscore
Definition: BinaryDigit
_
Page: 30
Chapter: 3
Section: 10.1

Name: OctalDigit
Definition: (one of)
0 1 2 3 4 5 6 7
Page: 29
Chapter: 3
Section: 10.1

Name: BinaryDigit
Definition: (one of)
0 1
Page: 30
Chapter: 3
Section: 10.1

Question: What occur if an integral literal is not in its legal range ?
Answer: compile time error
Page: 31
Chapter: 3
Section: 10.1

Definition: compile time error
Page: 34
Chapter: 3
Section: 10.2
Denoted by: What occur if a int literal is not in the range of ints ?

Name: BinaryExponentIndicator
Definition: (one of)
p P
Page: 34
Chapter: 3
Section: 10.2

Name: BinaryExponent
Definition: BinaryExponentIndicator SignedInteger
Page: 34
Chapter: 3
Section: 10.2

Name: HexSignificand
Definition: HexNumeral [ . ]
0 x [HexDigits] . HexDigits
0 X [HexDigits] . HexDigits
Page: 34
Chapter: 3
Section: 10.2

Name: HexadecimalFloatingPointLiteral
Definition: HexSignificand BinaryExponent [FloatTypeSuffix]
Page: 34
Chapter: 3
Section: 10.2

Name: FloatTypeSuffix:
Definition: (one of)
f F d D
Page: 33
Chapter: 3
Section: 10.2

Name: Sign:
Definition: (one of)
+ -
Page: 33
Chapter: 3
Section: 10.2

Name: SignedInteger
Definition: [Sign] Digits
Page: 33
Chapter: 3
Section: 10.2

Name: ExponentIndicator:
Definition: (one of)
e E
Page: 33
Chapter: 3
Section: 10.2

Name: ExponentPart
Definition: ExponentIndicator SignedInteger
Page: 33
Chapter: 3
Section: 10.2

Name: DecimalFloatingPointLiteral:
Definition: Digits . [Digits] [ExponentPart] [FloatTypeSuffix]
Page: 33
Chapter: 3
Section: 10.2
Definition2: . Digits [ExponentPart] [FloatTypeSuffix]
Conjdef: Either
Definition3: Digits ExponentPart [FloatTypeSuffix]
Definition4: Digits [ExponentPart] FloatTypeSuffix

Name: FloatingPointLiteral
Definition: DecimalFloatingPointLiteral
Page: 33
Chapter: 3
Section: 10.2
Definition2: HexadecimalFloatingPointLiteral
Conjdef: Either

Question: Type of floating point literal
Answer: Float if followed by F or f, otherwise double
Page: 34
Chapter: 3
Section: 10.2

Question: What occurs if a floating-point literal is too slow, and become non-zero denormalized number according to IEEE754
Answer: Compile time error
Page: 34
Chapter: 3
Section: 10.2

Question: What occurs if a floating-point literal is too large, and become infinity according to IEEE754
Answer: Compile time error
Page: 34
Chapter: 3
Section: 10.2

Question: What occurs if a floating-point literal is too slow, and become zero according to IEEE754
Answer: Compile time error
Page: 34
Chapter: 3
Section: 10.2

Instruction: POSITIVE_INFINITY
Page: 34
Language: java
Chapter: 3
Section: 10.2
Returns: positive infinity not creating a exception
Abbreviation: 1f/0f

Instruction: NEGATIVE_INFINITY
Page: 34
Language: java
Chapter: 3
Section: 10.2
Returns: Negative infinity not creating a exception
Abbreviation: -1f/0f

Instruction: true false
Page: 34
Language: java
Chapter: 3
Section: 10.2
Returns: A boolean literal
Typ: boolean
Name: BooleanLiteral

Name: SingleCharacter:
Definition: InputCharacter but not ' or \
Page: 34
Chapter: 3
Section: 10.4

Name: CharacterLiteral
Definition: ' SingleCharacter '
Page: 34
Chapter: 3
Section: 10.4
Definition2: ' EscapeSequence '
Conjdef: Either

Instruction: 'foo'
Page: 34
Language: java
Chapter: 3
Section: 10.4
Returns: the character foo
Typ: char

Question: What occurs when 'foobar' occurs in a code ?
Answer: error
Page: 34
Chapter: 3
Section: 10.4

Name: StringCharacter
Definition: InputCharacter but not " or \
Page: 34
Chapter: 3
Section: 10.5
Definition2: EscapeSequence
Conjdef: Either

Name: StringLiteral
Definition: " {StringCharacter} "
Page: 34
Chapter: 3
Section: 10.5

Question: What occur if line terminator occur in a string ?
Answer: compile time error
Page: 37
Chapter: 3
Section: 10.5

Instruction: "foo_1...foo_n"
Page: 37
Language: java
Chapter: 3
Section: 10.5
Returns: The string whose i-th character is foo_i
Typ: string

Name: ZeroToThree
Definition: (one of)
0 1 2 3
Page: 37
Chapter: 3
Section: 10.6

Name: OctalEscape:
Definition: \ OctalDigit
Page: 39
Chapter: 3
Section: 10.6
Definition2: \ OctalDigit OctalDigit
Conjdef: Either
Definition3: \ ZeroToThree OctalDigit OctalDigit

Name: EscapeSequence
Definition: OctalEscape
Page: 39
Chapter: 3
Section: 10.6
Definition2: \b \t \n \f \r \" \' \\
Conjdef: Either

Instruction: null
Page: 39
Language: java
Chapter: 3
Section: 10.7
Name: NullLiteral

Name: Separator
Definition: () {} []
Page: 39
Chapter: 3
Section: 11
Definition2: ; , .
Conjdef: Either
Definition3: ...
Definition4: @
Definition5: ::

Name: Operators
Definition: =
Page: 39
Chapter: 3
Section: 11
Definition2: == < > <= >=
Conjdef: Either
Definition3: ! + - * / & | ^ % << >> >>>
!= += -= *= /= &= |= ^= %= <<= >>= >>>=
Definition4: ++ --
Definition5: && ||
Definition6: ? :
Definition7: -> ~

Typ: byte
Meaning: signed 8 bit integral type
Page: 31
Chapter: 3
Section: 10.1

Typ: short
Meaning: signed 2 byte integral type
Page: 31
Chapter: 3
Section: 10.1

Typ: int
Meaning: signed 4 byte integral type. Some method allow to interpret it as unsigned
Page: 31
Chapter: 3
Section: 10.1

Typ: long
Meaning: signed 8 byte integral type. Some method allow to interpret it as unsigned
Page: 31
Chapter: 3
Section: 10.1