anchor.diff:  	;
   	
   binary_exp2
  -	: oper register Separator (register|memory)
  -	| oper memory Separator register
  +	: oper register Separator (register|memory)	| oper memory Separator register
   	;
   
   notarguments
  -	: opera	;
  +	: opera
  +    ;
   	
   binary_exp3
   	: operat (register|memory) Separator (register|Integer|memory)
  -	
   	;
   	
   unuary_exp3
  
positive.code:     Ported to Antlr4 by Tom Everett <tom@khubla.com>
  */
  
  
  grammar ASM;
  
  @header{ package com.Ostermiller.Syntax;}
  
  //This are the parser rules for ASM
  compilationUnit:
  	(segments|directive_exp1)*
  	'end' Identifier
  	;
  
  segments
  	:	
  	Identifier 'segments' 'para' 'public'
  	(code|proc)*
  	Identifier 'ends'
  	;
  
  proc	:
  	Identifier 'proc'
  	( code )*
  	'ret'
  	Identifier 'endp'
  	;
  	
  code: 
        binary_exp1
        | binary_exp10
        | binary_exp11
        | binary_exp12
        | binary_exp2
        | binary_exp3
        | binary_exp4
        | binary_exp5
        | binary_exp6
        | binary_exp7
        | binary_exp8
        | binary_exp9
        | unuary_exp1
        | unuary_exp2
        | unuary_exp3
        | unuary_exp4
        | unuary_exp5
        | notarguments
        | variabledeclaration
        | directive_exp1	
  	;
  	
  binary_exp1
  	: o register Separator (register|Integer|memory)
  	| o memory Separator (register|Integer)
  	;
  	
  unuary_exp1
  
negative.code: 	: re opera	
  	;
  	
  directive_exp1	
  	: (directives Identifier | directives)
  	;
  	
  variabledeclaration
  	: Identifier ty (question|String|Integer) 	
  	;
  	
  memory	
  	:
  	'[' (register|Identifier) ('+' ((register ('+' (Integer|Hexnum|Octalnum))? )|Integer|Hexnum|Octalnum))? ']'
  	;
  	
  segmentos
  	:
  	DS | ES | CS | SS | GS | FS
  	;
  
  register
  	:
  	AH|AL|AX|BH|BL|BX|CH|CL|CX|DH|DL|DX|SI|DI|SP|BP|EAX|EBX|ECX|EDX|ESI|EDI|ESP|EBP
  	;
  
  o
  	:
  	MOV|CMP|TEST
  	;
  
  op
  	:
  	PUSH
  	;
  
  ope
  	:	
  	POP|IDIV|INC|DEC|NEG|MUL|DIV|IMUL|NOT|SETPO|SETAE|SETNLE|SETC|SETNO|SETNB|SETP|SETNGE|SETL|SETGE|SETPE|SETNL|SETNZ|SETNE|SETNC|SETBE|SETNP|SETNS|SETO|SETNA|SETNAE|SETZ|SETLE|SETNBE|SETS|SETE|SETB|SETA|SETG|SETNG
  	;
  
  oper
  	:	
  	XCHG
  	;
  
  opera
  	:	
  	POPAD|AAA|POPA|POPFD|CWD|LAHF|PUSHAD|PUSHF|AAS|BSWAP|PUSHFD|CBW|CWDE|XLAT|AAM|AAD|CDQ|DAA|SAHF|DAS|INTO|IRET|CLC|STC|CMC|CLD|STD|CLI|STI|MOVSB|MOVSW|MOVSD|LODS|LODSB|LODSW|LODSD|STOS|STOSB|STOSW|SOTSD|SCAS|SCASB|SCASW|SCASD|CMPS|CMPSB|CMPSW|CMPSD|INSB|INSW|INSD|OUTSB|OUTSW|OUTSD
  	;
  
  operat
  	: 
  	ADC|ADD|SUB|CBB|XOR|OR
  	;
  
  operato
  	:
  	JNBE|JNZ|JPO|JZ|JS|LOOPNZ|JGE|JB|JNB|JO|JP|JNO|JNL|JNAE|LOOPZ|JMP|JNP|LOOP|JL|JCXZ|JAE|JNGE|JA|LOOPNE|LOOPE|JG|JNLE|JE|JNC|JC|JNA|JBE|JLE|JPE|JNS|JECXZ|JNG
  	;
  
  operator
  	:
  	MOVZX|BSF|BSR
  	;
  
  l
  	:	
  	LES|LEA|LDS|INS|OUTS
  	;
  
  x
  	:	
  	XADD|CMPXCHG
  	;
  
  s
  	:	
  	SHL|SHR|ROR|ROL|RCL|SAL|RCR|SAR
  	;
  
  sh
  	:	
  	SHRD|SHLD
  	;
  
  b
  	:	
  	BTR|BT|BTC
  	;
  
  call
  	:	
  	CALL
  	;
  
  interruption
  	:	
  	INT|RETN|RET|RETF
  	;
  
  in
  	:	
  	IN
  	;
  
  out
  	:	
  	OUT
  	;
  
  re
  	:	
  	REP|REPE|REPZ|REPNE|REPNZ
  	;
  
  directives
  	: 
  	ALPHA|CONST|CREF|XCREF|DATA|DATA2|DOSSEG|ERR|ERR1|ERR2|ERRE|ERRNZ|ERRDEF|ERRNDEF|ERRB|ERRNB|ERRIDN|ERRDIF|EVEN|LIST|WIDTH|MASK|SEQ|XLIST|EXIT|MODEL
  	;
  
  ty
  	:	
  	BYTE|SBYTE|DB|WORD|SWORD|DW|DWORD|SDWORD|DD|FWORD|DF|QWORD|DQ|TBYTE|DT|REAL4|REAL8|REAL|FAR|NEAR|PROC
  	;
  
  question
  	: 
  	QUESTION
  	;
  
  time
  	:	
  	TIMES
  	;
  
  //So let's start  defining the ASM lexer
  //Groups of reserved words
  