Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/86b/lex.lx

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



%{
#include "dat.h"
#include "fns.h"
#include "y.tab.h"
%}

%%

"CS:"		{ yylval.prefix = PrefixCS; return PREFIX; }
"SS:"		{ yylval.prefix = PrefixSS; return PREFIX; }
"DS:"		{ yylval.prefix = PrefixDS; return PREFIX; }
"ES:"		{ yylval.prefix = PrefixES; return PREFIX; }
"FS:"		{ yylval.prefix = PrefixFS; return PREFIX; }
"GS:"		{ yylval.prefix = PrefixGS; return PREFIX; }

"AX"		{ yylval.r32 = RAX; return REG32; }
"CX"		{ yylval.r32 = RCX; return REG32; }
"DX"		{ yylval.r32 = RDX; return REG32; }
"BX"		{ yylval.r32 = RBX; return REG32; }
"SP"		{ yylval.r32 = RSP; return REG32; }
"BP"		{ yylval.r32 = RBP; return REG32; }
"SI"		{ yylval.r32 = RSI; return REG32; }
"DI"		{ yylval.r32 = RDI; return REG32; }

"AL"		{ yylval.r8 = RAL; return REG8; }
"CL"		{ yylval.r8 = RCL; return REG8; }
"DL"		{ yylval.r8 = RDL; return REG8; }
"BL"		{ yylval.r8 = RBL; return REG8; }

"AH"		{ yylval.r8 = RAH; return REG8; }
"CH"		{ yylval.r8 = RCH; return REG8; }
"DH"		{ yylval.r8 = RDH; return REG8; }
"BH"		{ yylval.r8 = RBH; return REG8; }

[ \t]		{ }
"["			{ return '['; }
"]"			{ return ']'; }
","			{ return ','; }
"*"			{ return '*'; }
"\n"		{ return '\n'; }
0[Xx][0-9A-Fa-f]+ { yylval.i = strtol(yytext+2, nil, 16); return CONST; }
0[0-7]+		{ yylval.i = strtol(yytext+1, nil, 8); return CONST; }
[1-9][0-9]*	{ yylval.i = strtol(yytext, nil, 10); return CONST; }
0			{ yylval.i = 0; return CONST; }
[A-Z]*		{ yylval.s = atom(yytext); return OP; }


%%

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].