Beispiel #1
0
 public CMachineCodes(PIC_PROCESSOR ProcessorType)
 {
     // Create instances of the code generation classes depending on the
     // processor type.
     switch (ProcessorType)
     {
         case PIC_PROCESSOR.PIC16F84:
             BitOperations       = new CP16F84BitOperations();
             ByteOperations      = new CP16F84ByteOperations();
             ControlOperations   = new CP16F84ControlOperations();
             break;
         default:
             BitOperations       = null;
             ByteOperations      = null;
             ControlOperations   = null;
             break;
     }
 }
Beispiel #2
0
        public CCompiler(String SourceFile, String Keywords, String SpecialRegisters, PIC_PROCESSOR microp)
        {
            try
            {
                String HexFile = SourceFile.Substring(0, SourceFile.Length - 5);
                HexFile += ".hex";
                m_LexScanner = new CLexScanner(SourceFile, Keywords);
                m_SymbolTbl = new CSymbolTable(SpecialRegisters);
                m_CodeGenerator = new CPicCodeGenerator(HexFile);
                m_MachineCodeOps = new CMachineCodes(microp);
                m_Parser = new CParser(m_LexScanner, m_SymbolTbl, m_MachineCodeOps, m_CodeGenerator);
            }
            catch (Exception)
            {
                throw new CCompilerException("Error initialising the compiler", TErrorCodes.COMPILER_ERROR);
            }
            finally
            {

            }
        }