[Next] [Previous] [Top]

"RTL Grammar"

5 Tokens


Bold-faced non-terminals in this grammar are the tokens in the grammar rules above. As usual, tokens are defined as the longest possible sequence of characters that are in the language defined by the grammar given below. The meta-notations "one of "..."", "any but x," and "x..y" are used to concisely list a range of alternative characters. space, tab, and newline stand for the corresponding characters.

Literals suffixed with a p or P character are boxed literals (for languages like Cecil and Smalltalk with boxed values), while unsuffixed literal tokens are unboxed literals.

A long is an 8-byte integer (e.g. a Java long value), while an integer is a word-sized integer. A float is an IEEE single-precision 4-byte float, while a double is an IEEE double-precision 8-byte float. An unboxed character literal is just an integer by another name. An unboxed string literal is a pointer to a statically-allocated array of characters. String literals are not null-terminated by default; an explicit \0 should be added to the end of the string literal to get a terminating null character. Characters defined by \ followed by 1-3 digits interpret the digits as an octal ascii code; decimal or hexadecimal interpretations can be selected by using the d or x prefix, respectively.

name	::=	(letter | "_") {letter | digit | "_"}

integer	::=	int_body ["p" | "P"]
int_body	::=	["-"] [radix] hex_digits
radix	::=	digits "_"
hex_digits	::=	hex_digit {hex_digit}
hex_digit	::=	digit | one of "a..fA..F"

long	::=	int_body ("l" | "L") ["p" | "P"]

float	::=	float_body ["p" | "P"]
float_body	::=	["-"] integer "." hex_digits [exponent]
	|	["-"] integer exponent
exponent	::=	"^" ["+" | "-"] digits
digits	::=	digit {digit}

double	::=	float_body ("d" | "D") ["p" | "P"]

character	::=	"'" char "'" ["p" | "P"]

string	::=	""" { char | line_break } """ ["p" | "P"]
char	::=	any | "\" escape_char
escape_char	::=	one of "abfnrtv'"\?0"
 	|	["o"|"d"] digit [digit [digit]]
	|	"x" hex_digit [hex_digit]
line_break	::=	"\" {whitespace} new_line {whitespace} "\"
			characters between \'s are not part of the string

letter	::=	one of "a..zA..Z"
digit	::=	one of "0..9"
punct	::=	one of "!#$%^&*-+=<>/?~\|"