package ga050426;

public interface Grammar {

	// Assembler grammar

	String alpha = "(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z)";
	String hex = "(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|A|B|C|D|E|F)";
	String num = "(0|1|2|3|4|5|6|7|8|9)";
	String alnum = "(" + alpha + "|" + hex + ")";
	String comma = "(|\t| |\r)*,(|\t| |\r)*"; // Comma arguments separator!
	String minus = "(|\t| |\r)*-(|\t| |\r)*";
	String plus = "(|\t| |\r)*\\+(|\t| |\r)*";
	String dec = "("+ num +")+";
	String minusDec = "-("+ num +")+";
	String hexNum = "0x(" + hex + "){1,4}";
	String minusHexNum = "-0x(" + hex + "){1,4}";
	
	String chars = "(A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|0|1|2|3|4|5|6|7|8|9|\\?|!|\\[|\\]|\\{|\\}|.|,|;)";
	String punct = "(,|.|;|:)";
	String space = "(\t| |\r)+";
	String simbol = alpha + "(" + alnum + ")*";
	String comment = "(|\t| |\r)*(;(" + chars + ")*)*";
	String label = "(|" + space + ")*" + simbol;
	String emptyln = "(|\t| |\r)+";
	String star = "\\*";
	String immed = "(" + hexNum + "|" + simbol + "|" + dec + "|" + star + "|" + minusDec + "|" + minusHexNum + ")";
	
	
	//Directives
	String BEGdir = "(|" + space + ")*BEG" + comment;
	String ENDdir = "(|" + space + ")*END" + comment;
	
	String DCdir = "(|" + space + ")*DC" + space + immed + comment;
	String DSdir = "(|" + space + ")*DS" + space + immed + comment;
	String EQUdir = label +"(|" + space + ")*EQU" + space + immed + comment;
	
	String TXTsegDir = "(|" + space + ")*TXT("+ num +")*"+ comment;
	String BSSsegDir = "(|" + space + ")*BSS("+ num +")*"+ comment;
	String DATsegDir = "(|" + space + ")*DAT("+ num +")*"+ comment;

	String DEFdir = "(|" + space + ")*DEF" + space + simbol + "(" + comma
	+ space + simbol + ")*" + comment;
	String USEdir = "(|" + space + ")*USE" + space + simbol + "(" + comma
	+ space + immed + ")*" + comment;
	
	// Instructions:
	//ONE ADDRESS
	String NOPins = "(|" + space + ")*NOP" + comment;
	String CLAins = "(|" + space + ")*CLA" + comment;
	String CLCins = "(|" + space + ")*CLC" + comment;
	String CLXins = "(|" + space + ")*CLX" + comment;
	String CMCins = "(|" + space + ")*CMC" + comment;
	String INCins = "(|" + space + ")*INC" + comment;
	String DECins = "(|" + space + ")*DEC" + comment;
	String INXins = "(|" + space + ")*INX" + comment;
	String DEXins = "(|" + space + ")*DEX" + comment;
	String TAXins = "(|" + space + ")*TAX" + comment;
	String INIins = "(|" + space + ")*INI" + comment;
	String INAins = "(|" + space + ")*INA" + comment;
	String OTIins = "(|" + space + ")*OTI" + comment;
	String OTAins = "(|" + space + ")*OTA" + comment;
	String PSHins = "(|" + space + ")*PSH" + comment;
	String POPins = "(|" + space + ")*POP" + comment;
	String SHLins = "(|" + space + ")*SHL" + comment;
	String SHRins = "(|" + space + ")*SHR" + comment;
	String MSAins = "(|" + space + ")*MSA" + comment;
	String MASins = "(|" + space + ")*MAS" + comment;
	String LDAins = "(|" + space + ")*LDA" + comment;
	String LDXins = "(|" + space + ")*LDX" + comment;
	String RETins = "(|" + space + ")*RET" + comment;
	String HLTins = "(|" + space + ")*HLT" + comment;

	//TWO ADDRESS
	String LDIins = "(|" + space + ")*LDI" + space + immed + comment;	
	String LDDins = "(|" + space + ")*LDD" + space + immed + comment;
	String LDRins = "(|" + space + ")*LDR" + space + immed + comment;
	String STAins = "(|" + space + ")*STA" + space + immed + comment;
	String STXins = "(|" + space + ")*STX" + space + immed + comment;
	String ADDins = "(|" + space + ")*ADD" + space + immed + comment;
	String ADXins = "(|" + space + ")*ADX" + space + immed + comment;
	String ADIins = "(|" + space + ")*ADI" + space + immed + comment;
	String ADCins = "(|" + space + ")*ADC" + space + immed + comment;
	String SUBins = "(|" + space + ")*SUB" + space + immed + comment;
	String SBXins = "(|" + space + ")*SBX" + space + immed + comment;
	String SBIins = "(|" + space + ")*SBI" + space + immed + comment;
	String SBCins = "(|" + space + ")*SBC" + space + immed + comment;
	String CMPins = "(|" + space + ")*CMP" + space + immed + comment;
	String CPIins = "(|" + space + ")*CPI" + space + immed + comment;
	String ANAins = "(|" + space + ")*ANA" + space + immed + comment;
	String ANIins = "(|" + space + ")*ANI" + space + immed + comment;
	String ORAins = "(|" + space + ")*ORA" + space + immed + comment;
	String ORIins = "(|" + space + ")*ORI" + space + immed + comment;
	String BRRins = "(|" + space + ")*BRR" + space + immed + comment;
	String BZEins = "(|" + space + ")*BZE" + space + immed + comment;
	String BNZins = "(|" + space + ")*BNZ" + space + immed + comment;
	String BPZins = "(|" + space + ")*BPZ" + space + immed + comment;
	String BNGins = "(|" + space + ")*BNG" + space + immed + comment;
	String BCCins = "(|" + space + ")*BCC" + space + immed + comment;
	String BCSins = "(|" + space + ")*BCS" + space + immed + comment;
	String JSRins = "(|" + space + ")*JSR" + space + immed + comment;
	
}
