[Next] [Previous] [Up] [Top] [Contents] [Index]

A BNF

Lexical Grammar

Comments

comment:
// ...the rest of the line
/* ...everything even across lines... */

Tokens

token:
name
symbol
number
character-literal
string
unary-operator
binary-operator
punctuation
#-word

punctuation:
one of ( ) , . ; [ ] { } :: - = == =>
one of #( #[ ## ? ?? ?= ...

#-word:
one of #t #f #next #rest #key #all-keys #include

Reserved Words

reserved-word:
core-word
begin-word
function-word
define-body-word
define-list-word

core-word:
one of define end handler let local macro otherwise

The following reserved words are exported by the Dylan module:

begin-word:
one of begin block case for if method
one of select unless until while

function-word:
(none)

define-body-word:
one of class library method module

define-list-word:
one of constant variable

Names, Symbols and Keywords

name:
word
\ word
operator-name

unreserved-name:
any word that is not also a reserved-word
\ word
operator-name

ordinary-name:
unreserved-name
define-body-word
define-list-word

constrained-name:
name : word
name : binary-operator
: word

operator-name:
\ unary-function-operator
\ binary-function-operator

symbol:
word:
# string

word:
leading-alphabetic
leading-numeric alphabetic-character leading-alphabetic
leading-graphic leading-alphabetic

leading-alphabetic:
alphabetic-character
leading-alphabetic any-character

leading-numeric:
numeric-character
leading-numeric any-character

leading-graphic:
graphic-character
leading-graphic any-character

any-character:
alphabetic-character
numeric-character
graphic-character
special-character

alphabetic-character:
one of 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

numeric-character:
one of 0 1 2 3 4 5 6 7 8 9

graphic-character:
one of ! & * < > | ^ $ % @ _

special-character:
one of - + ~ ? / =

Operators

unary-operator:
unary-function-operator

binary-operator:
binary-function-operator
special-operator

unary-function-operator:
one of - ~

binary-function-operator:
one of + - * / ^ = == ~= ~== < <= > >=

special-operator:
one of & | :=

Character and String Literals

character-literal:
' character '

character:
any printing character (including space) except for ' or \
\ escape-character
\ '

string:
" more-string

more-string:
string-character more-string
"

string-character:
any printing character (including space) except for " or \
\ escape-character
\ "

escape-character:
one of \ a b e f n r t 0
< hex-digits >

Numbers

number:
integer
ratio
floating-point

integer:
binary-integer
octal-integer
signopt decimal-integer
hex-integer

binary-integer:
#b binary-digit
binary-integer binary-digit

octal-integer:
#o octal-digit
octal-integer octal-digit

decimal-integer:
decimal-digit
decimal-integer decimal-digit

hex-integer:
#x hex-digit
hex-integer hex-digit

hex-digits:
hex-digit
...

binary-digit:
one of 0 1

octal-digit:
one of 0 1 2 3 4 5 6 7

decimal-digit:
one of 0 1 2 3 4 5 6 7 8 9

hex-digit:
one of 0 1 2 3 4 5 6 7 8 9 A B C D E F

ratio:
signopt decimal-integer / decimal-integer

floating-point:
signopt decimal-integeropt . decimal-integer exponentopt
signopt decimal-integer . decimal-integeropt exponentopt
signopt decimal-integer exponent

exponent:
E signopt decimal-integer

sign:
one of + -


Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker