nextuppreviouscontents
Next:Sorts Up:Expressions, parsing and pretty Previous:Notations.   Contents

Subsections

Lexical analysis.

Blanks

The following characters are blank: space, newline, horizontal tabulation, line feed and form feed. These blanks are ignored, but they will separate adjacent tokens (like identifier, numbers, etc, described bellow) that could be confused as one single token.

Comments

Comments are started by (* and ended by *). Nested comments are handled properly. All comments are ignored (except in some special case used for TeX generation, see the chapter 9) but like blank they separate adjacent tokens.

String, numbers, ...

Strings and characters can use the following escape sequences :

SequenceCharacter denoted
\nnewline (LF)
\rreturn (CR)
\ttabulation (TAB)
\dddThe character of code ddd in decimal
\cThe character c when c is not in 0...9nbt

string-character:=any character but " or an escape sequence.
string:=" {string-character} "
char-character:=any character but ' or an escape sequence.
char:='char-character'
natural:={ 0...9 }$_+$
integer:=[-] natural
float:=integer [.natural] [(e$\vert$E) integer]

Identifiers

Identifiers are used to give names to mathematical objects. The definition is more complex than for most programming languages. This is because we want to have the maximum freedom to get readable files. So for instance the following are valid identifiers: A_1', <=, <_A. Moreover, in relation with the module system, identifiers can be prefixed with extension like in add.assoc or prod.assoc.

letter:=A...Z$\vert$a...z
end-ident:={letter$\vert$0...9$\vert$_ } { ' }
atom-alpha-ident:=letterend-ident
alpha-ident:=atom-alpha-ident { .atom-alpha-ident}
special-char:=!$\vert$%$\vert$&$\vert$*$\vert$+$\vert$,$\vert$-$\vert$/$\vert$:$\vert$;$\vert$<$\vert$=$\vert$>$\vert$
  @$\vert$[$\vert$]$\vert$\$\vert$#$\vert$^$\vert$`$\vert$\$\vert$|$\vert${$\vert$}$\vert$~
atom-special-ident:={special-char}$_+$ [_end-ident]
special-ident:=atom-special-ident { .atom-alpha-ident }
any-ident:=alpha-ident$\vert$special-ident
pattern:=any-ident$\vert$ (_ {.atom-alpha-ident })
unif-var:=? {natural}
sort-var:=' {letter}$_+$


Exemples:

Special characters

The following characters are token by themselves:

($\vert$)$\vert$.$\vert$$


nextuppreviouscontents
Next:Sorts Up:Expressions, parsing and pretty Previous:Notations.   Contents
Christophe Raffalli 2005-03-02