OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zasm.l] - Diff between revs 54 and 69

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 54 Rev 69
Line 7... Line 7...
** Purpose:     The lexical analyzer for the assembler.  This converts assembler
** Purpose:     The lexical analyzer for the assembler.  This converts assembler
**              input into tokens, to feed the parser.
**              input into tokens, to feed the parser.
**
**
**
**
** Creator:     Dan Gisselquist, Ph.D.
** Creator:     Dan Gisselquist, Ph.D.
**              Gisselquist Tecnology, LLC
**              Gisselquist Technology, LLC
**
**
********************************************************************************
********************************************************************************
**
**
** Copyright (C) 2015, Gisselquist Technology, LLC
** Copyright (C) 2015, Gisselquist Technology, LLC
**
**
Line 139... Line 139...
(?i:nop)        { yylval.u_op = OP_NOOP;  return BAREOP; }
(?i:nop)        { yylval.u_op = OP_NOOP;  return BAREOP; }
(?i:noop)       { yylval.u_op = OP_NOOP;  return BAREOP; }
(?i:noop)       { yylval.u_op = OP_NOOP;  return BAREOP; }
(?i:break)      { yylval.u_op = OP_BREAK; return BAREOP; }
(?i:break)      { yylval.u_op = OP_BREAK; return BAREOP; }
(?i:brk)        { yylval.u_op = OP_BREAK; return BAREOP; }
(?i:brk)        { yylval.u_op = OP_BREAK; return BAREOP; }
(?i:busy)       { yylval.u_op = OP_BUSY;  return BAREOP; }
(?i:busy)       { yylval.u_op = OP_BUSY;  return BAREOP; }
 
(?i:brev)       { yylval.u_op = OP_BREV;  return DUALOP; }
 
(?i:popc)       { yylval.u_op = OP_POPC;  return DUALOP; }
 
(?i:divu)       { yylval.u_op = OP_DIVU;  return DUALOP; }
 
(?i:divs)       { yylval.u_op = OP_DIVS;  return DUALOP; }
 
(?i:fpadd)      { yylval.u_op = OP_FPADD;  return DUALOP; }
 
(?i:fpsub)      { yylval.u_op = OP_FPSUB;  return DUALOP; }
 
(?i:fpmul)      { yylval.u_op = OP_FPMUL;  return DUALOP; }
 
(?i:fpdiv)      { yylval.u_op = OP_FPDIV;  return DUALOP; }
 
(?i:fpcvt)      { yylval.u_op = OP_FPCVT;  return DUALOP; }
 
(?i:fpint)      { yylval.u_op = OP_FPINT;  return DUALOP; }
(?i:equ)        { return EQU; }
(?i:equ)        { return EQU; }
(?i:fill)       { return FILL; }
(?i:fill)       { return FILL; }
(?i:word)       { return WORD; }
(?i:word)       { return WORD; }
"__"[hH][eE][rR][eE]"__" { return HERE; }
"__"[hH][eE][rR][eE]"__" { return HERE; }
[\.][dD][aA][tT] { return WORD; }
[\.][dD][aA][tT] { return WORD; }
[\.][zZ]/[ \t\n]        { yylval.u_cond = ZPARSER::ZIPC_Z; return COND; }
[\.](?i:z)/[ \t\n]      { yylval.u_cond = ZPARSER::ZIPC_Z;  return COND; }
[\.][nN][eE]/[ \t\n]    { yylval.u_cond = ZPARSER::ZIPC_NZ; return COND; }
[\.](?i:ne)/[ \t\n]     { yylval.u_cond = ZPARSER::ZIPC_NZ; return COND; }
[\.][nN][zZ]/[ \t\n]    { yylval.u_cond = ZPARSER::ZIPC_NZ; return COND; }
[\.](?i:nz)/[ \t\n]     { yylval.u_cond = ZPARSER::ZIPC_NZ; return COND; }
[\.][gG][eE]/[ \t\n]    { yylval.u_cond = ZPARSER::ZIPC_GE; return COND; }
[\.](?i:ge)/[ \t\n]     { yylval.u_cond = ZPARSER::ZIPC_GE; return COND; }
[\.][gG][tT]/[ \t\n]    { yylval.u_cond = ZPARSER::ZIPC_GT; return COND; }
[\.](?i:gt)/[ \t\n]     { yylval.u_cond = ZPARSER::ZIPC_GT; return COND; }
[\.][lL][tT]/[ \t\n]    { yylval.u_cond = ZPARSER::ZIPC_LT; return COND; }
[\.](?i:lt)/[ \t\n]     { yylval.u_cond = ZPARSER::ZIPC_LT; return COND; }
[\.][nN]/[ \t\n]        { yylval.u_cond = ZPARSER::ZIPC_LT; return COND; }
[\.](?i:n)/[ \t\n]      { yylval.u_cond = ZPARSER::ZIPC_LT; return COND; }
[\.][cC]/[ \t\n]        { yylval.u_cond = ZPARSER::ZIPC_C; return COND; }
[\.](?i:c)/[ \t\n]      { yylval.u_cond = ZPARSER::ZIPC_C;  return COND; }
[\.][vV]/[ \t\n]        { yylval.u_cond = ZPARSER::ZIPC_V; return COND; }
[\.](?i:v)/[ \t\n]      { yylval.u_cond = ZPARSER::ZIPC_V;  return COND; }
[_A-Za-z][_a-zA-Z0-9]* { yylval.u_id  = strdup(yytext); return IDENTIFIER; }
[_A-Za-z][_a-zA-Z0-9]* { yylval.u_id  = strdup(yytext); return IDENTIFIER; }
"$"?[-]?0[xX][0-9A-Fa-f]+ { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL,16);return INT;}
"$"?[-]?0[xX][0-9A-Fa-f]+ { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL,16);return INT;}
"$"?[-]?0[0-7]+           { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL, 8);return INT;}
"$"?[-]?0[0-7]+           { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL, 8);return INT;}
"$"?[-]?[1-9][0-9]*       { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL,10);return INT;}
"$"?[-]?[1-9][0-9]*       { yylval.u_ival = strtoul(yytext+(((*yytext)=='$')?1:0),NULL,10);return INT;}
"$"?[-]?[1-9A-Fa-f][0-9A-Fa-f]*h {yylval.u_ival=strtoul(yytext+(((*yytext)=='$')?1:0),NULL,16); return INT;}
"$"?[-]?[1-9A-Fa-f][0-9A-Fa-f]*h {yylval.u_ival=strtoul(yytext+(((*yytext)=='$')?1:0),NULL,16); return INT;}

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.