⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tokens_h.h

📁 单片机宏汇编器的源程序。给一些爱好者作为学习编译原理和 C 程序设计的例子.
💻 H
字号:
//---------------------------------------------------------------------------
//  Tokens_H.h 
//---------------------------------------------------------------------------
#ifndef	Tokens_H.h  // 防止被重复引用
#define Tokens_H.h
//---------------------------------------------------------------------------
#include "Jtypes_H.h"
//---------------------------------------------------------------------------
#define TokenType  int16u

const TokenType GReaterKn  = '>';                              //
const TokenType LesserKen  = '<';                              //
const TokenType EQualKen   = '=';                              //
const TokenType DouSymKen  = ',';                              //

const TokenType  MOD       = '%';                              //
const TokenType  NOT       = '~';                              //
const TokenType  AND       = '&';                              //
const TokenType  OR        = '|';                              //
const TokenType  XOR       = '^';                              //

const TokenType SinglePlus = '0';                              //  +6
const TokenType SingleNeg  = '1';                              //  -5
const TokenType GRtEQUKen  = '2';                              //  >=
const TokenType LessEQUKn  = '3';                              //  <=
const TokenType NotEqual   = '4';                              //  <>

const TokenType  HIGH      = '5';                              //  取高位
const TokenType  LOW       = '6';                              //  取低位
const TokenType  SHL       = '7';                              //  左移
const TokenType  SHR       = '8';                              //  右移
const TokenType  NULTkn    = '9';                              //  NUL == ""

const TokenType GTE        = GRtEQUKen;
const TokenType LTE        = LessEQUKn;
const TokenType NE         = NotEqual;
const TokenType EQ         = EQualKen;
const TokenType GT         = GReaterKn;
const TokenType LT         = LesserKen;

const TokenType Interjectn = '!';                              //
const TokenType DoubleMMKn = '\"';                             //
const TokenType SingleNNKn = '\'';                             //
const TokenType WellCrossn = '#';                              //
const TokenType AlphaToken = '@';                              //
const TokenType DoorlarsKn = '$';                              //

const TokenType CommBegin  = 'p';                              //  /*
const TokenType CommEnd    = 'q';                              //  */
const TokenType txtCATtxt  = 'r';                              //  &连接文本和形参
const TokenType UndefSym   = 0x00ff;                           //  Undefined Symbol

const TokenType CommentKn  = ';';                              // ';'  注释
const TokenType EOLineKen  = 0x0100;                           // '\0' 换行

const TokenType SymblToken = 0x0101;                            //  符号
const TokenType WordSToken = 0x0102;                            //  单词
const TokenType ValueToken = 0x0103;                            //  数值

const TokenType LabelDefkn = 0x0104;                            //  xxxx  ':'
const TokenType EQUsDefken = 0x0105;                            //  xxxx  EQU
const TokenType SETsDefken = 0x0106;                            //  xxxx  SET
const TokenType BITsDefken = 0x0107;                            //  xxxx  BIT

const TokenType ReservInst = 0x0109;                            //  保留机器指令
const TokenType PseudoWord = 0x010a;                            //  保留伪代码
const TokenType RegisterKn = 0x010b;                            //  保留寄存器名

const TokenType ExpresnKn  = 0x010c;                            //
const TokenType OperandKn  = 0x010d;                            //
const TokenType KnownInst  = 0x010e;                            //
const TokenType ObjcodeKn  = 0x010f;                            //
const TokenType OPsetInst  = 0x0110;                            //

const TokenType WordCatKn  = 0x0111;                            // Word + '&'

const TokenType CharDatan  = 0x0112;                            // 'A'  字符型
const TokenType LongCharn  = 0x0113;                            //  'ABCDEF356'
const TokenType StrDataKn  = 0x0114;                            // “” 字串型

const TokenType DATADefKen = 0x0115;                            //
const TokenType XDATADefKn = 0x0116;                            //
const TokenType IDATADefKn = 0x0117;                            //
const TokenType CODEDefKen = 0x0118;                            //
const TokenType NumberDefn = 0x0119;

const TokenType NULLCharKn = 0x011a;                            //  ''
const TokenType ExpResult  = 0x011b;                            // 用于表达式计算中
const TokenType DBObjCode  = 0x011c;
const TokenType DWObjCode  = 0x011d;
const TokenType InstCode   = 0x011e;
const TokenType MacroPsw   = 0x011f;

const TokenType SEGMTDefkn = 0x0120;
const TokenType ArgvWordkn = 0x0121;
const TokenType MroParamtn = 0x0122;
const TokenType MroCalling = 0x0123;
const TokenType LRstringKn = 0x0124;

const TokenType CSEG       = 0x0130;
const TokenType DSEG       = 0x0131;
const TokenType XSEG       = 0x0132;
const TokenType ISEG       = 0x0133;
const TokenType BSEG       = 0x0134;

const TokenType BITABLE    = 0x0140;
const TokenType OVERABLE   = 0x0141;
const TokenType INPAGEKn   = 0x0142;
const TokenType PAGEKn     = 0x0143;
const TokenType UNITKn     = 0x0144;const TokenType INBLOCKKn  = 0x0145;const TokenType RSEG       = 0x0146;
const TokenType SEGMT      = 0x0147;
const TokenType EXTRNKn    = 0x0148;
const TokenType PUBLICKn   = 0x0149;
const TokenType NAMEToKn   = 0x014a;
const TokenType USINGTkn   = 0x014b;
const TokenType _AT_       = 0x014c;
const TokenType MacroDefkn = 0x014d;
const TokenType MacroCTRLn = 0x014e;
const TokenType WordList   = 0x014f;

const TokenType FormalArgv = 0x0150;
const TokenType LocalArgv  = 0x0151;
const TokenType MacroRefkn = 0x0152;
const TokenType ReptDefkn  = 0x0153;

const TokenType WarningKn  = 0x0180;                            //
const TokenType NormalERR  = 0x0181;                            //
const TokenType FatalERRn  = 0x0182;                            //

//---------------------------------------------------------------------------
const TokenType  NOP    = 0x0200;
const TokenType  MOV    = 0x0201;
const TokenType  MOVC   = 0x0202;
const TokenType  MOVX   = 0x0203;
const TokenType  PUSH   = 0x0204;
const TokenType  POP    = 0x0205;
const TokenType  XCH    = 0x0206;
const TokenType  XCHD   = 0x0207;
const TokenType  SWAP   = 0x0208;
const TokenType  ADD    = 0x0209;
const TokenType  DJNZ   = 0x020a;
const TokenType  ADDC   = 0x020b;
const TokenType  SUBB   = 0x020c;
const TokenType  INC    = 0x020d;
const TokenType  DEC    = 0x020e;
const TokenType  MUL    = 0x020f;

const TokenType  DIV    = 0x0210;
const TokenType  DA     = 0x0211;
const TokenType  ANL    = 0x0212;
const TokenType  ORL    = 0x0213;
const TokenType  XRL    = 0x0214;
const TokenType  CLR    = 0x0215;
const TokenType  CPL    = 0x0216;
const TokenType  RL     = 0x0217;
const TokenType  RLC    = 0x0218;
const TokenType  RR     = 0x0219;
const TokenType  RRC    = 0x021a;
const TokenType  SETB   = 0x021b;
const TokenType  ACALL  = 0x021c;
const TokenType  LCALL  = 0x021d;
const TokenType  RET    = 0x021e;
const TokenType  RETI   = 0x021f;

const TokenType  AJMP   = 0x0220;
const TokenType  LJMP   = 0x0221;
const TokenType  SJMP   = 0x0222;
const TokenType  JZ     = 0x0223;
const TokenType  JNZ    = 0x0224;
const TokenType  JC     = 0x0225;
const TokenType  JNC    = 0x0226;
const TokenType  JB     = 0x0227;
const TokenType  JNB    = 0x0228;
const TokenType  JBC    = 0x0229;
const TokenType  CJNE   = 0x022a;
const TokenType  JMP    = 0x022b;
const TokenType  CALL   = 0x022c;

//---------------------------------------------------------------------------
// 寻址方式
//---------------------------------------------------------------------------
const TokenType  _R0     =  0x0310;
const TokenType  _R1     =  0x0311;
const TokenType  _R2     =  0x0312;
const TokenType  _R3     =  0x0313;
const TokenType  _R4     =  0x0314;
const TokenType  _R5     =  0x0315;
const TokenType  _R6     =  0x0316;
const TokenType  _R7     =  0x0317;
const TokenType  _PC     =  0x0318;
const TokenType  _DPTR   =  0x0319;
const TokenType  _A      =  0x031a;
const TokenType  _AB     =  0x031b;
const TokenType  _C      =  0x031c;
const TokenType  _A_DPTR =  0x031d;   // A+DPTR 寄存器
const TokenType  _A_PC   =  0x031e;   // A+PC   寄存器

const TokenType  _slabl  =  0x0323;   // short-label
const TokenType  _sdirt  =  _slabl;   // 2 bytes     H3L8
const TokenType  _ldirt  =  _slabl;   // 2 bytes     H8L8
const TokenType  _xx_    =  0x0329;   // #xxH  立即数
const TokenType  _xxxx_  =  _xx_;     // #xxxxH 立即数
const TokenType  _aDPTR  =  0x0325;   // @DPTR   间接
const TokenType  _aA_PC  =  0x0326;   // @A+PC   间接
const TokenType  _aA_DPTR=  0x0327;   // @A+DPTR 间接
const TokenType  direct  =  0x0328;   // 8 bit

const TokenType  _neg_   =  0x032a;   // "/bit", 1 bytes
const TokenType  _a_     =  0x032b;   // @xxxxH  间接
const TokenType  _bit    =  0x032c;   //
const TokenType  _aR0    =  0x032d;   // @R0     间接
const TokenType  _aR1    =  0x032e;   // @R1     间接
const TokenType  _num    =  0x032f;   //    Number

const TokenType  _idata  =  0x0330;
const TokenType  _xdata  =  0x0331;
const TokenType  _code_  =  _slabl;
const TokenType  _segmt  =  0x0333;

//---------------------------------------------------------------------------
const TokenType  _AR0   = 0x0340;
const TokenType  _AR1   = 0x0341;
const TokenType  _AR2   = 0x0342;
const TokenType  _AR3   = 0x0343;
const TokenType  _AR4   = 0x0344;
const TokenType  _AR5   = 0x0345;
const TokenType  _AR6   = 0x0346;
const TokenType  _AR7   = 0x0347;
//---------------------------------------------------------------------------

const TokenType  ORG    = 0x0400;
const TokenType  DB     = 0x0401;
const TokenType  DW     = 0x0402;
const TokenType  BIT    = 0x0403;
const TokenType  END    = 0x0404;
const TokenType  EQU    = 0x0405;
const TokenType  SET    = 0x0406;
const TokenType  DATA   = 0x0407;
const TokenType  XDATA  = 0x0408;
const TokenType  IDATA  = 0x0409;
const TokenType  CODE   = 0x040a;
const TokenType  DS     = 0x040b;
const TokenType  DBIT   = 0x040c;
const TokenType  NUMBER = 0x040d;

const TokenType  EXITMTkn   = 0x0410;
const TokenType  IRPCTkn    = 0x0411;
const TokenType  IRPTkn     = 0x0412;
const TokenType  REPTTkn    = 0x0413;
const TokenType  LOCALTkn   = 0x0414;
const TokenType  ENDMTkn    = 0x0415;
const TokenType  MACROTkn   = 0x0416;

const TokenType  Dog_Skip    = 0x043d;
const TokenType  DogCtrlAgv  = 0x043e;
const TokenType  Dog_Ctrl    = 0x043f;
//-----------------------------------------
const TokenType  DATE_Tn     = 0x0440;
const TokenType  DEBUG_Tn    = 0x0441;
const TokenType  NODEBUG_Tn  = 0x0442;
const TokenType  ERR_PR_Tn   = 0x0443;
const TokenType  NO_EP_Tn    = 0x0444;
const TokenType  OBJOJ_Tn    = 0x0445;
const TokenType  NOOJ_Tn     = 0x0446;
const TokenType  PGLEN_Tn    = 0x0447;

const TokenType  PGWIDTH_Tn  = 0x0448;
const TokenType  PR_Tn       = 0x0449;
const TokenType  NOPR_Tn     = 0x044a;
const TokenType  SB_Tn       = 0x044b;
const TokenType  NOSB_Tn     = 0x044c;
const TokenType  XR_Tn       = 0x044d;
const TokenType  NOXR_Tn     = 0x044e;
const TokenType  TITLE_Tn    = 0x044f;

const TokenType  NOMOD51_Tn  = 0x0450;
const TokenType  MOD51_Tn    = 0x0451;
const TokenType  COND_Tn     = 0x0452;
const TokenType  NOCOND_Tn   = 0x0453;
const TokenType  MARO_Tn     = 0x0454;
const TokenType  NOMARO_Tn   = 0x0455;
const TokenType  RB_Tn       = 0x0456;
const TokenType  NORB_Tn     = 0x0457;

const TokenType  EJECT_Tn    = 0x0458;
const TokenType  INCLU_Tn    = 0x0459;
const TokenType  LI_Tn       = 0x045a;
const TokenType  NOLI_Tn     = 0x045b;
const TokenType  GEN_Tn      = 0x045c;
const TokenType  NOGEN_Tn    = 0x045d;
const TokenType  SAV_Tn      = 0x045e;
const TokenType  RSTO_Tn     = 0x045f;

const TokenType  SET_Tn      = 0x0460;
const TokenType  RESET_Tn    = 0x0461;
const TokenType  IF_Tn       = 0x0462;
const TokenType  ELSEIF_Tn   = 0x0463;
const TokenType  ELSE_Tn     = 0x0464;
const TokenType  ENDIF_Tn    = 0x0465;

const TokenType  IF_Kn       = 0x0466;
const TokenType  ELSEIF_Kn   = 0x0467;
const TokenType  ELSE_Kn     = 0x0468;
const TokenType  ENDIF_Kn    = 0x0469;
const TokenType  IFNUL_Kn    = 0x046a;
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// 段类型
const TokenType SEG_CODE    =  0;
const TokenType SEG_XDATA   =  1;
const TokenType SEG_DATA    =  2;
const TokenType SEG_IDATA   =  3;
const TokenType SEG_BIT     =  4;
//--------------------------------------------------------------------------
// 标号类型
const TokenType LB_CODE     =  SEG_CODE;
const TokenType LB_XDATA    =  SEG_XDATA;
const TokenType LB_DATA     =  SEG_DATA;
const TokenType LB_IDATA    =  SEG_IDATA;
const TokenType LB_BIT      =  SEG_BIT;
const TokenType LB_NUM      =  5;

const TokenType LB_SEG      =  6;
const TokenType LB_REG      =  7;
//---------------------------------------------------------------------------
// 再定位类型
const TokenType SEG_ABS     =  0;
const TokenType SEG_UNIT    =  1;
const TokenType SEG_BITABLE =  2;
const TokenType SEG_INPAGE  =  3;
const TokenType SEG_INBLOCK =  4;
const TokenType SEG_PAGE    =  5;
//---------------------------------------------------------------------------


//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
//               Written by JamesyFront.    ZLGmcu Dev.Co.Ltd.  2002.
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -