Lexical Grammar [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Reference Manual
Lexical Grammar
Tokens
token ::= keyword
identifier
constant
string-literal
operator
punctuator
preprocessing-token ::=
header-name
identifier
pp-number
character-constant
string-literal
operator
punctuator
each non-white-space character cannot be one of the above
Keywords
keyword ::= any word from the set:
auto extern sizeof
break float static
case for struct
char goto switch
const if typedef
continue int union
default long unsigned
do register void
double return volatile
else short while
enum signed
Identifiers
identifier ::= nondigit
identifier nondigit
identifier digit[REV BEG]
identifier dollar-sign[REV END]
nondigit ::= any character from the set:
_ a b c d e f g h i j k l m n o p
q r s t u v w x y z A B C D E F G
H I J K L M N O P Q R S T U V W X[REV BEG]
Y Z $[REV END]
digit ::= any character from the set:
0 1 2 3 4 5 6 7 8 9
[REV BEG]
dollar-sign ::= the $ character[REV END]
Constants
constant ::=
floating-constant
integer-constant
enumeration-constant
character-constant
floating-constant ::=
fractional-constant [exponent-part] [floating-suffix]
digit-sequence exponent-part [floating-suffix]
fractional-constant ::=
[digit-sequence] . digit-sequence
digit-sequence .
exponent-part ::=
e [sign] digit-sequence
E [sign] digit-sequence
sign ::=
+
-
digit-sequence ::=
digit
digit-sequence digit
floating-suffix ::=
f l F L
integer-constant ::=
decimal-constant [integer-suffix]
octal-constant [integer-suffix]
hexadecimal-constant [integer-suffix]
decimal-constant ::=
nonzero-digit
decimal-constant digit
octal-constant ::=
0
octal-constant octal-digit
hexadecimal-constant ::=
0x hexadecimal-digit
0X hexadecimal-digit
hexadecimal-constant hexadecimal-digit
nonzero-digit ::= any character from the set:
1 2 3 4 5 6 7 8 9
octal-digit ::= any character from the set
0 1 2 3 4 5 6 7
hexadecimal-digit ::= any character from the set
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F
integer-suffix ::=
unsigned-suffix [long-suffix]
long-suffix [unsigned-suffix]
unsigned-suffix ::=
u U
long-suffix ::=
l L
enumeration-constant ::= identifier
character-constant ::=
'c-char-sequence'
L'c-char-sequence'
c-char-sequence ::=
c-char
c-char-sequence c-char
c-char ::=
any character in the source character set except
the single quote ('), backslash (\), or new-line character
escape-sequence
escape-sequence ::=
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence
simple-escape-sequence ::=
\' \" \? \\ \ddd \xdd
\a \b \f \n \r \t \v
octal-escape-sequence ::=
\ octal-digit
\ octal-digit octal-digit
\ octal-digit octal-digit octal-digit
hexadecimal-escape-sequence ::=
\x hexadecimal-digit
hexadecimal-escape-sequence hexadecimal-digit
String Literals
string-literal ::=
"[s-char-sequence]"
L"[s-char-sequence]"
s-char-sequence ::=
s-char
s-char-sequence s-char
s-char ::=
any character in the source character set except
the double-quote (") , backslash (\),
or new-line character
escape-sequence
Operators
operator ::= One selected from:
[ ] ( ) . ->
++ -- & * + - ~ ! sizeof
/ %
<< >> < > <= >= == != ^ | && ||
? :
= *= /= %= += -= <<= >>= &= ^= |=
, # ##
Punctuators
punctuator ::= One selected from:
[ ] ( ) { } * , : = ; ... #
Header Names
header-name ::=
<h-char-sequence>
"q-char-sequence"
h-char-sequence ::=
h-char
h-char-sequence h-char
h-char ::=
any character in the source character set except
the newline character and >
q-char-sequence ::=
q-char
q-char-sequence q-char
q-char ::=
any character in the source character set except
the newline character and "
Preprocessing Numbers
pp-number ::=
digit
. digit
pp-number digit
pp-number nondigit
pp-number e sign
pp-number E sign
pp-number .
MPE/iX 5.0 Documentation