home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
compcomp
/
tpyacc
/
exprlex.l
< prev
next >
Wrap
Text File
|
1991-05-01
|
497b
|
29 lines
(* Lexical analyzer for the sample Yacc program in Expr.y. *)
L [A-Za-z]
D [0-9]
%%
var result : integer;
{D}+(\.{D}+)?([Ee][+-]?{D}+)? begin
val(yytext, yylval.yyReal, result);
if result=0 then
return(NUM)
else
return(ILLEGAL)
end;
{L} begin
yylval.yyInteger := ord(upCase(yytext[1]))-
ord('A')+1;
return(ID)
end;
" " ;
. |
\n returnc(yytext[1]);