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.

  1. 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.

  2. Don't allow spaces inside tokens. Space should never be an operator.

  3. Different kinds of tokens should look different at the left end (initial character).

  4. Avoid ambiguous combinations of tokens that would require long look-ahead.

  5. Avoid ``noise'' such as ugly special characters. These require extra keystrokes and make programs hard to read. %rax

  6. Are upper- and lower-case letters equivalent?