Contents
Page-10
Prev
Next
Page+10
Index
Lexical Language Design
A language designer should avoid ambiguity in the design
of the lexical syntax of a language.
- Reserved words are a good idea to avoid ambiguity
between user symbols and language command words.
DO 10 I = 1,25 3.EQ.J
DO 10 I = 1.25 3.E7+X
FORMAT(I5)
FORMAT(I5) = 1.2
There should not be too many reserved words.
- Don't allow spaces inside tokens. Space, or nothing,
should never be an operator.
- Different kinds of tokens should look different at the
left end (initial character).
- Avoid ambiguous combinations of tokens that would require
long look-ahead.
- Avoid ``noise'' such as ugly special characters. These require
extra keystrokes and make programs hard to read. %rax
- Are upper- and lower-case letters equivalent?