1984-05-17 13:42:36 +00:00
|
|
|
%{
|
1984-05-17 14:13:36 +00:00
|
|
|
#ifndef NORCSID
|
1994-06-24 11:31:16 +00:00
|
|
|
static char rcsid2[] = "$Id$";
|
1984-05-17 14:13:36 +00:00
|
|
|
#endif
|
|
|
|
|
1984-05-17 13:42:36 +00:00
|
|
|
/*
|
1987-03-10 01:42:07 +00:00
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
1984-05-17 13:42:36 +00:00
|
|
|
*
|
|
|
|
* Author: Hans van Staveren
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern long atol();
|
2013-05-12 19:45:55 +00:00
|
|
|
extern char patid[128];
|
|
|
|
extern int lino;
|
|
|
|
|
|
|
|
#include "y.tab.h"
|
|
|
|
|
1984-05-17 13:42:36 +00:00
|
|
|
%}
|
|
|
|
%%
|
1984-08-16 16:08:39 +00:00
|
|
|
\"[^"]*\" { strncpy(patid,yytext,sizeof(patid)); return(STRING); }
|
1984-05-17 13:42:36 +00:00
|
|
|
notreg return(NOTREG);
|
|
|
|
sfit return(SFIT);
|
|
|
|
ufit return(UFIT);
|
|
|
|
rotate return(ROTATE);
|
|
|
|
p return(PSIZE);
|
|
|
|
w return(WSIZE);
|
|
|
|
defined return(DEFINED);
|
|
|
|
samesign return(SAMESIGN);
|
|
|
|
rom return(ROM);
|
|
|
|
[a-zA-Z]{3} {
|
|
|
|
int m;
|
|
|
|
m = mlookup(yytext);
|
|
|
|
if (m==0) {
|
1991-01-11 14:28:59 +00:00
|
|
|
yyless(1);
|
|
|
|
return yytext[0];
|
1984-05-17 13:42:36 +00:00
|
|
|
} else {
|
|
|
|
yylval.y_int = m;
|
|
|
|
return(MNEM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
"&&" return(AND2);
|
|
|
|
"||" return(OR2);
|
|
|
|
"&" return(AND1);
|
|
|
|
"|" return(OR1);
|
|
|
|
"^" return(XOR1);
|
|
|
|
"+" return(ARPLUS);
|
|
|
|
"-" return(ARMINUS);
|
|
|
|
"*" return(ARTIMES);
|
|
|
|
"/" return(ARDIVIDE);
|
|
|
|
"%" return(ARMOD);
|
|
|
|
"==" return(CMPEQ);
|
|
|
|
"!=" return(CMPNE);
|
|
|
|
"<" return(CMPLT);
|
|
|
|
"<=" return(CMPLE);
|
|
|
|
">" return(CMPGT);
|
|
|
|
">=" return(CMPGE);
|
|
|
|
"!" return(NOT);
|
|
|
|
"~" return(COMP);
|
|
|
|
"<<" return(LSHIFT);
|
|
|
|
">>" return(RSHIFT);
|
|
|
|
[0-9]+ { long l= atol(yytext);
|
|
|
|
if (l>32767) yyerror("Number too big");
|
|
|
|
yylval.y_int= (int) l;
|
|
|
|
return(NUMBER);
|
|
|
|
}
|
|
|
|
[ \t] ;
|
|
|
|
. return(yytext[0]);
|
|
|
|
\n { lino++; return(yytext[0]); }
|
|
|
|
:[ \t]*\n[ \t]+ { lino++; return(':'); }
|
|
|
|
^"# "[0-9]+.*\n { lino=atoi(yytext+2); }
|
1984-05-17 14:13:36 +00:00
|
|
|
^\#.*\n { lino++; }
|