home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
modula2
/
alexcoco
/
taste.lex
< prev
next >
Wrap
Text File
|
1987-04-14
|
1KB
|
44 lines
SCANNER taste
CHARACTER SETS
letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
digit = "0123456789";
CR = CHR(13);
LF = CHR(10);
CtlZ = CHR(26);
endfile = CHR(4);
-- the token numbers must correspond to the declaration sequence of the
-- terminals in taste.ATG
KEYWORDS
1 = "BEGIN" 7 = "IF" 13 = "TRUE"
2 = "BOOLEAN" 8 = "INTEGER" 14 = "VAR"
3 = "DO" 9 = "PROGRAM" 15 = "WHILE"
4 = "ELSE" 10 = "PROCEDURE" 16 = "WRITE"
5 = "END" 11 = "READ"
6 = "FALSE" 12 = "THEN"
TOKEN CLASSES
27 = letter {letter | digit} EXCEPT KEYWORDS. -- ident
28 = digit {digit}. -- number
SINGLE TOKENS
17 = "+". 21 = "=". 25 = ";".
18 = "-". 22 = "<". 26 = ":".
19 = "*". 23 = ">". 0 = CtlZ | endfile.
20 = "/". 24 = ".". 29 = CR LF.
ERROR TOKEN = 30
COMMENTS
FROM "{" TO "}"
FROM "(*" TO "*)"
END